张量 Tensor
torch.is_tensor[source]
torch.is_tensor(obj)
如果obj是一个pytorch张量,则返回True
torch.is_storage(obj)
torch.set_default_tensor_type(t)
设置pytorch中默认的浮点类型,一般使用pytorch进行运算时候使用的都是浮点数来进行计算。
默认浮点数
torch.numel
返回input张量中的元素个数
torch.set_printoptions
torch.set_printoptions(precision=None, threshold=None, edgeitems=None, linewidth=None, profile=None)
precision -浮点数输出的精度位数
threshold 阈值
edgeitems 汇总显示中