Skip to content

Commit 8a07b30

Browse files
committed
逐一修改,给映射列表按照torch api排序
1 parent 4b7d642 commit 8a07b30

25 files changed

+73
-92
lines changed

docs/guides/model_convert/convert_from_pytorch/api_difference/invok_only_diff/torch.Tensor.to_sparse.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
### [torch.Tensor.to_sparse](https://pytorch.org/docs/stable/tensors.html#torch.Tensor.to_sparse)
44

55
```python
6-
torch.Tensor.to_sparse(sparseDims)
6+
torch.Tensor.to_sparse(sparse_dim)
77
```
88

99
### [paddle.Tensor.to_sparse_coo](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/Tensor/to_sparse_coo_cn.html#paddle/Tensor/to_sparse_coo_cn#cn-api-paddle-Tensor-to_sparse_coo)

docs/guides/model_convert/convert_from_pytorch/api_difference/invok_only_diff/torch.autograd.Function.forward.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class cus_tanh(torch.autograd.Function):
3131
return grad
3232

3333
# Paddle 写法
34-
class cus_tanh(paddle.autograd.Function):
34+
class cus_tanh(paddle.autograd.PyLayer):
3535
@staticmethod
3636
def forward(ctx, x, func=paddle.square):
3737
ctx.func = func

docs/guides/model_convert/convert_from_pytorch/api_difference/invok_only_diff/torch.autograd.function.FunctionCtx.mark_non_differentiable.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class cus_func(torch.autograd.Function):
3232
return grad_x
3333

3434
# Paddle 写法
35-
class cus_func(paddle.autograd.Function):
35+
class cus_func(paddle.autograd.PyLayer):
3636
@staticmethod
3737
def forward(ctx, x):
3838
a = x + x

docs/guides/model_convert/convert_from_pytorch/api_difference/invok_only_diff/torch.autograd.function.FunctionCtx.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class MyFunction(torch.autograd.Function):
3131
return grad_input
3232

3333
# Paddle 写法
34-
class MyFunction(paddle.autograd.Function):
34+
class MyFunction(paddle.autograd.PyLayer):
3535
@staticmethod
3636
def forward(ctx, x):
3737
ctx.x = x

docs/guides/model_convert/convert_from_pytorch/api_difference/invok_only_diff/torch.autograd.function.FunctionCtx.save_for_backward.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class cus_tanh(torch.autograd.Function):
3131
return grad
3232

3333
# Paddle 写法
34-
class cus_tanh(paddle.autograd.Function):
34+
class cus_tanh(paddle.autograd.PyLayer:
3535
@staticmethod
3636
def forward(ctx, x):
3737
y = paddle.nn.functional.tanh(x=x)

docs/guides/model_convert/convert_from_pytorch/api_difference/invok_only_diff/torch.autograd.function.FunctionCtx.saved_tensors.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class cus_tanh(torch.autograd.Function):
3232
return grad
3333

3434
# Paddle 写法
35-
class cus_tanh(paddle.autograd.Function):
35+
class cus_tanh(paddle.autograd.PyLayer):
3636
@staticmethod
3737
def forward(ctx, x):
3838
y = paddle.nn.functional.tanh(x=x)

docs/guides/model_convert/convert_from_pytorch/api_difference/invok_only_diff/torch.autograd.function.FunctionCtx.set_materialize_grads.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class cus_tanh(torch.autograd.Function):
3030
return grad
3131

3232
# Paddle 写法
33-
class cus_tanh(paddle.autograd.Function):
33+
class cus_tanh(paddle.autograd.PyLayer):
3434
@staticmethod
3535
def forward(ctx, x):
3636
ctx.set_materialize_grads(False)

docs/guides/model_convert/convert_from_pytorch/api_difference/invok_only_diff/torch.backends.cudnn.version.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,9 @@ paddle.device.get_cudnn_version()
1818

1919
```python
2020
# PyTorch 写法
21-
import torch
22-
2321
result = torch.backends.cudnn.version() == torch.backends.cudnn.version()
2422

25-
2623
# Paddle 写法
27-
import paddle
28-
2924
result = paddle.device.get_cudnn_version() == paddle.device.get_cudnn_version()
3025

3126
```

docs/guides/model_convert/convert_from_pytorch/api_difference/invok_only_diff/torch.cuda.is_bf16_supported.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
### [torch.cuda.is_bf16_supported](https://pytorch.org/docs/stable/generated/torch.cuda.is_bf16_supported.html#torch.cuda.is_bf16_supported)
44

55
```python
6-
torch.cuda.is_bf16_supported(including_emulation)
6+
torch.cuda.is_bf16_supported(including_emulation=True)
77
```
88

99
### [paddle.amp.is_bfloat16_supported](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/amp/is_bfloat16_supported_cn.html#paddle/amp/is_bfloat16_supported_cn#cn-api-paddle-amp-is_bfloat16_supported)
1010

1111
```python
12-
paddle.amp.is_bfloat16_supported(device)
12+
paddle.amp.is_bfloat16_supported(device=None)
1313
```
1414

1515
两者功能一致,但调用方式不一致,具体如下:

docs/guides/model_convert/convert_from_pytorch/api_difference/invok_only_diff/torch.cuda.stream.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,11 @@ paddle.device.stream_guard(stream)
1818

1919
```python
2020
# PyTorch 写法
21-
context = torch.cuda.stream(stream=s)
21+
with torch.cuda.stream(stream=s):
22+
result = data1 + data2
2223

2324
# Paddle 写法
24-
context = paddle.device.stream_guard(stream=s)
25+
with paddle.device.stream_guard(stream=s):
26+
result = data1 + data2
27+
2528
```

0 commit comments

Comments
 (0)