TypeError: view(): argument ‘size’ (position 1) must be tuple of ints, not Tensor
Can you add the code line where you tried to use .view()
. The error seems like maybe you passed a tensor instead of integer. But if you provide the code, perhaps we would be able to help.
An example of such error is the following:
>>> x = torch.randn(5, 3, 8, 8)
>>> ind = torch.LongTensor([5, 3, 64])
## passing a tensor will cause an error:
>>> x = x.view(ind)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: view(): argument 'size' (position 1) must be tuple of ints, not Tensor
## passing integers will be fine:
>>> x = x.view(5, 3, 64)
>>> x.shape
torch.Size([5, 3, 64])