RuntimeError: Input harus memiliki 3 dimensi, mendapat 4 situs: stackoverflow.com
import torch
r = torch.tensor([[[5,10,11,18,19],[900,98,97,51,64],[89,87,45,64,88]]])#this is a 4 dimensions
print(r)
>>> tensor([[[5,10,11,18,19],[900,98,97,51,64],[89,87,45,64,88]]])
#if we convert it into 3 dimensions from 4 dimensions,we need to use torch.squeeze() function
r.squeeze()
>>> tensor([[5,10,11,18,19],[900,98,97,51,64],[89,87,45,64,88]])
ai-lover