ACGAN-PyTorch icon indicating copy to clipboard operation
ACGAN-PyTorch copied to clipboard

Label dimensionality always fails

Open AmitMY opened this issue 7 years ago • 1 comments

From the following line:

aux_label.data.resize_(batch_size).copy_(label)

I am getting the following error:

RuntimeError: expand(torch.FloatTensor{[1, 1]}, size=[1]): the number of sizes provided (1) must be greater or equal to the number of dimensions in the tensor (2)

For a custom dataset. The dataset is using TensorDataset from PyTorch, and is supplying a 1D tensor, but for some reason it fails as [1, 1].

The way I create the dataset:

...
tensor_y = torch.stack([torch.Tensor(i) for i in y]) # i is a 1D vector
return data.TensorDataset(tensor_x, tensor_y) 

AmitMY avatar Sep 25 '18 13:09 AmitMY

i have the same question

JoJo-ops avatar Apr 10 '19 13:04 JoJo-ops