-
Notifications
You must be signed in to change notification settings - Fork 5.9k
[API Compatibility]add paddle.narrow #74546
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
你的PR提交成功,感谢你对开源项目的贡献! |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #74546 +/- ##
==========================================
Coverage ? 96.00%
==========================================
Files ? 1
Lines ? 25
Branches ? 0
==========================================
Hits ? 24
Misses ? 1
Partials ? 0 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
3f9c7b8 to
f16d8d8
Compare
python/paddle/tensor/manipulation.py
Outdated
| def narrow( | ||
| input: Tensor, | ||
| dim: int, | ||
| start: Sequence[int | Tensor], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
类型注解这里,是 int | Tensor
python/paddle/tensor/manipulation.py
Outdated
| [8, 6] | ||
| >>> # the stride is [6, 1]. | ||
| """ | ||
| offset *= paddle.core.size_of_dtype(x.dtype) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里改动应该会不兼容,可以把这行改动放到 paddle.narrow 里面去
zhwesky2010
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
XiaoguangHu01
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
5c55b6c
51e0a30 to
31f0973
Compare
|
/re-run all-failed |
1 similar comment
|
/re-run all-failed |
|
/re-run all-failed |
1 similar comment
|
/re-run all-failed |
XiaoguangHu01
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
luotao1
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM for skipif
PR Category
Operator Mechanism
PR Types
New features
Description
Pcard-73145
添加paddle.narrow
torch是直接调用其slice算子,slice是调用了as_strided返回视图,保证返回的tensor与输入tesnor共享内存 https://github.com/pytorch/pytorch/blob/ee1b0412b919dfb358d5a697b3be49621497fbc2/aten/src/ATen/native/TensorShape.cpp#L1665