torch.Tensor.float¶
torch.Tensor.float¶
torch.Tensor.float(memory_format)
参数差异¶
| PyTorch | PaddlePaddle | 备注 | | ————- | ———— | —————————————————— | | memory_format | - | tensor 存储形式,转写无需考虑该参数 | |- | dtype | 转换后的 tensor 类型 |
转写示例¶
# torch 写法
x.float()
# paddle 写法
x.astype('float32')