-
Notifications
You must be signed in to change notification settings - Fork 764
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add api_difference * 'Fix'
- Loading branch information
Showing
2 changed files
with
38 additions
and
0 deletions.
There are no files selected for viewing
19 changes: 19 additions & 0 deletions
19
...el_convert/convert_from_pytorch/api_difference/Tensor/torch.Tensor.is_signed.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
## [ 组合替代实现 ]torch.Tensor.is_signed | ||
|
||
### [torch.Tensor.is_signed](https://pytorch.org/docs/stable/generated/torch.Tensor.is_signed.html#torch.Tensor.is_signed) | ||
|
||
```python | ||
torch.Tensor.is_signed() | ||
``` | ||
|
||
Paddle 无此 API,需要组合实现。 | ||
|
||
### 转写示例 | ||
|
||
```python | ||
# Pytorch 写法 | ||
y = x.is_signed() | ||
|
||
# Paddle 写法 | ||
y = x.dtype not in [paddle.uint8] | ||
``` |
19 changes: 19 additions & 0 deletions
19
...onvert/convert_from_pytorch/api_difference/others/torch.testing.assert_close.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
## [ 组合替代实现 ]torch.testing.assert_close | ||
|
||
### [torch.testing.assert_close](https://pytorch.org/docs/stable/testing.html?highlight=assert_close#torch.testing.assert_close) | ||
|
||
```python | ||
torch.testing.assert_close(actual, expected, *, allow_subclasses=True, rtol=None, atol=None, equal_nan=False, check_device=True, check_dtype=True, check_layout=True, check_stride=False, msg=None) | ||
``` | ||
|
||
Paddle 无此 API,需要组合实现。 | ||
|
||
### 转写示例 | ||
|
||
```python | ||
# Pytorch 写法 | ||
torch.testing.assert_close(actual, expected, rtol=rtol, atol=atol, equal_nan=True, msg='error messege') | ||
|
||
# Paddle 写法 | ||
assert paddle.allclose(actual, expected, rtol=rtol, atol=atol, equal_nan=True).item(), 'error messege' | ||
``` |