clvrai / ACGAN-PyTorch

MIT License
268 stars 62 forks source link

Label dimensionality always fails #10

Open AmitMY opened 6 years ago

AmitMY commented 6 years ago

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) 
JoJo-ops commented 5 years ago

i have the same question