【发布时间】:2020-06-22 21:27:31
【问题描述】:
正如问题所暗示的,我正在尝试将images 转换为张量。
X, y = train_sequence[idx]
images = Variable(torch.from_numpy(X)).to(device) # [batch, channel, H, W]
masks = Variable(torch.from_numpy(y)).to(device)
print(type(images)) ## Output: <class 'torch.Tensor'>
images = transforms.Normalize((0.5, 0.5, 0.5, 0.5, 0.5), (0.5, 0.5, 0.5,0.5, 0.5))(images)
masks = transforms.Normalize((0.5), (0.5))(masks)
但我得到了错误
---> 19 images = transforms.Normalize((0.5, 0.5, 0.5, 0.5, 0.5), (0.5, 0.5, 0.5,0.5, 0.5))(images)
TypeError: tensor is not a torch image.
【问题讨论】:
标签: numpy machine-learning deep-learning pytorch tensor