diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.signbit.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.signbit.md new file mode 100644 index 00000000000..1dfe7df4ce3 --- /dev/null +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.signbit.md @@ -0,0 +1,15 @@ +## [无参数]torch.Tensor.signbit + +### [torch.Tensor.signbit](https://pytorch.org/docs/stable/generated/torch.Tensor.signbit.html#torch-signbit) + +```python +torch.Tensor.signbit() +``` + +### [paddle.Tensor.signbit](https://github.com/PaddlePaddle/Paddle/blob/9ce3a54f456011c664c70fbcd318f2e1af0a7d81/python/paddle/tensor/math.py#L7175) + +```python +paddle.Tensor.signbit() +``` + +两者功能一致,均无参数。 diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/functional/torch.nn.functional.pdist.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/functional/torch.nn.functional.pdist.md new file mode 100644 index 00000000000..52e72be99a2 --- /dev/null +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/functional/torch.nn.functional.pdist.md @@ -0,0 +1,22 @@ +## [仅参数名不一致]torch.nn.functional.pdist + +### [torch.nn.functional.pdist](https://pytorch.org/docs/stable/generated/torch.nn.functional.pdist.html#torch.nn.functional.pdist) + +```python +torch.nn.functional.pdist(input, p=2) +``` + +### [paddle.nn.functional.pdist](https://github.com/PaddlePaddle/Paddle/blob/210442ec30e5038809865a6105dd38308d1df2e0/python/paddle/nn/functional/distance.py#L111) + +```python +paddle.nn.functional.pdist(x, p=2.0) +``` + +两者功能一致且参数用法一致,仅参数名不一致,具体如下: + +### 参数映射 + +| PyTorch | PaddlePaddle | 备注 | +| ------- | ------------ | ------------------------------- | +| input | x | 输入的 Tensor,仅参数名不一致。 | +| p | p | 计算 p-norm 距离的 p 参数。 | diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.histogramdd.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.histogramdd.md new file mode 100644 index 00000000000..6ec155e5af4 --- /dev/null +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.histogramdd.md @@ -0,0 +1,25 @@ +## [仅参数名不一致]torch.histogramdd + +### [torch.histogramdd](https://pytorch.org/docs/stable/generated/torch.histogramdd.html#torch-histogramdd) + +```python +torch.histogramdd(input, bins, *, range=None, weight=None, density=False) -> (Tensor, Tensor[]) +``` + +### [paddle.histogramdd](https://github.com/PaddlePaddle/Paddle/blob/a19227d9ee0e351363a4bb27b50b1becbec58a6c/python/paddle/tensor/linalg.py#L3875) + +```python +paddle.histogramdd(x, bins=10, ranges=None, density=False, weights=None, name=None) +``` + +两者功能一致且参数用法一致,仅参数名不一致,具体如下: + +### 参数映射 + +| PyTorch | PaddlePaddle | 备注 | +| ------- | ------------ | ----------------------------- | +| input | x | 输入 Tensor,仅参数名不一致。 | +| bins | bins | 直方图 bins(直条)的个数序列。 | +| range | ranges | bins 的范围,仅参数名不一致。 | +| weight | weights | 权重,仅参数名不一致。 | +| density | density | 结果中每个 bin 是否包含权重。 | diff --git a/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.signbit.md b/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.signbit.md new file mode 100644 index 00000000000..356423039d8 --- /dev/null +++ b/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.signbit.md @@ -0,0 +1,34 @@ +## [torch 参数更多]torch.signbit + +### [torch.signbit](https://pytorch.org/docs/stable/generated/torch.signbit.html#torch-signbit) + +```python +torch.signbit(input, *, out=None) +``` + +### [paddle.signbit](https://github.com/PaddlePaddle/Paddle/blob/9ce3a54f456011c664c70fbcd318f2e1af0a7d81/python/paddle/tensor/math.py#L7175) + +```python +paddle.signbit(x, name=None) +``` + +Pytorch 相比 Paddle 支持更多其他参数,具体如下: + +### 参数映射 + +| PyTorch | PaddlePaddle | 备注 | +| ------- | ------------ | ---------------------------------------------- | +| input | x | 输入 Tensor,仅参数名不一致。 | +| out | - | 表示输出的 Tensor,Paddle 无此参数,需要转写。 | + +### 转写示例 + +#### out:指定输出 + +```python +# Pytorch 写法 +torch.signbit([1., 2., 3., -1.], out=y) + +# Paddle 写法 +paddle.assign(paddle.signbit([1., 2., 3., -1.]), y) +```