Tensor基本数据类型
32位浮点torch.float3264位浮点torch.float6432位整数torch.int.3216位整数torch.int.1664位整数torch.int.64Tensor和numpy转换
torch.from_numpy(numpy矩阵) )。
Tensor矩阵. numpy (
示例:
x=torch.tensor ([ 6,2 ],dtype=torch.float32 ) x=torch.tensor ) [ 6,2 ],dtype=torch.float 32 (xout ) ) 10 dype=torch.float 32 (xout [ 16 ] : tensor ([0.0.],[0.0.],[0.0.],)