When I start training the model, I’m getting the following warning:
/Users/maxtian/anaconda3/lib/python3.6/site-packages/torch/nn/functional.py:1594: UserWarning: Using a target size (torch.Size([128])) that is different to the input size (torch.Size([128, 1, 1, 1])) is deprecated. Please ensure they have the same size.
"Please ensure they have the same size.".format(target.size(), input.size()))
How can I fix this, I’m thinking it might be due to the torch.ones/torch.zeros
Thanks your answer. Can I ask you if we can fix the label size ,and change the input size (torch.Size([128, 1, 1, 1])) to be [128]
for example,
input = input.reshape(-1)
to make the torch.Size([128, 1, 1, 1]) to be [128]
and so solve the question “UserWarning: different input and target sizes”