[ 返回参数类型不一致 ]torch.equal

torch.equal

torch.equal(input,
            other)

paddle.equal_all

paddle.equal_all(x,
                 y,
                 name=None)

两者功能一致但返回参数类型不同,具体如下:

参数映射

PyTorch PaddlePaddle 备注
input x 输入 Tensor,仅参数名不一致。
other y 输入 Tensor,仅参数名不一致。
返回值 返回值 PyTorch 返回 bool 类型,Paddle 返回 0-D bool Tensor,需要转写。

转写示例

返回值

# torch 中的写法
torch.equal(x, y)

# paddle 中的写法
paddle.equal_all(x, y).item()