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