[ 仅 API 调用方式不一致 ]torch.equal

torch.equal

torch.equal(input, other)

paddle.compat.equal

paddle.compat.equal(input, other)

两者功能和用法一致,但 API 路径不一致,只需修改 torch 前缀为 paddle.compat,具体如下:

转写示例

# PyTorch 写法
result = torch.equal(a, b)

# Paddle 写法
result = paddle.compat.equal(a, b)