1.torch.cat():
error:RuntimeError: zero-dimensional tensor (at position 0) cannot be concatenated
torch.cat() 函数传入的tuple里面的tensor维度不可以为0,创建一个非list的tensor的时候,就有了zero-dimensional tensor,在pytorch0.4版本中,加入了zero-dimensional tensor 的概念,做出了区分。 有人说pytorch0.3支持,需要降版本到0.3。但但但是为什么我的0.3也不行呢
import torch
x = torch.tensor(0.5)
y = torch.tensor(0.4)
m = torch.cat((x, y))
>> "RuntimeError: zero-dimensional tensor (at position 0)"
x = torch.tensor([0.5])
y = torch.tensor([0.4])
m = torch.cat((x, y))
>> m tensor([0.5, 0,4])