本文记录了如何在Python中查看Tensor的尺寸和数据类型查看。更新于2019.03.22。
文章目录
Tensor尺寸查看
命令:
x.shape
例子:
input = torch.randn(20,16,50,32)
input.shape
输出为:
注意调用的时候不要用x.shape()
,否则会报错:AttributeError: 'Tensor' object has no attribute 'get_shape'
数据类型查看
命令:
x.type()
例子:
input = torch.randn(20,16,50,32)
input.type()
输出:
更多内容,欢迎加入星球讨论。