torch.equal(input, other)
paddle.equal_all(x, y, name=None)
两者功能一致但返回参数类型不同,具体如下:
注:PyTorch 返回 bool 类型,Paddle 返回 0-D bool Tensor
# PyTorch 写法 out = torch.equal(x, y) # Paddle 写法 out = paddle.equal_all(x, y) out = out.item()