查看变量类型:例如
a=[[1,2,3],
[1,2,3]] print(type(a)) 输出:<type 'list'>
因为这里的b仍然是1*200*200的大小,所以要重新reshape一下,适合输出图像
plt.imshow(b.reshape(200,200),cmap = 'gray')
plt.show()
这里我们做的就是将torch.FloatTensor 转换为numpy才可以显示
torch.cat()
拼接Tensor,第二个参数表示拼接的维度。0表示为按纵向拼接,这里拼接后的大小为400x2,1表示横向拼接,该参数默认为0。
TypeError: cat received an invalid combination of arguments - got (tuple, int), but expected one of:
* (sequence[torch.FloatTensor] seq)* (sequence[torch.FloatTensor] seq, int dim)
didn't match because some of the arguments have invalid types: (!tuple!, int)