-
Notifications
You must be signed in to change notification settings - Fork 5.9k
[API Compatibility] add device/dtype/bias paramters and its unit test for nn.Conv1/2/3D/nn.Embedding #74641
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提交成功,感谢你对开源项目的贡献! |
python/paddle/nn/layer/conv.py
Outdated
| weight_attr: ParamAttrLike | None = None, | ||
| bias_attr: ParamAttrLike | None = None, | ||
| data_format: DataLayout3D = "NCDHW", | ||
| device: str | PlaceLike | None = None, |
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.
这两个位置如果插入到前面去,和torch保持位置一致,不兼容影响大吗
python/paddle/nn/functional/conv.py
Outdated
| return _C_ops.add(pre_bias, bias) | ||
| else: | ||
| return pre_bias | ||
| with ( |
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.
只改变weight、bias的device,这里中间计算过程的place要改变吗
| param = param.to(device) | ||
| return param | ||
| else: | ||
| if in_pir_mode(): |
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.
老静态图可以不管,pir支持device吗
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #74641 +/- ##
===========================================
Coverage ? 100.00%
===========================================
Files ? 3
Lines ? 38
Branches ? 0
===========================================
Hits ? 38
Misses ? 0
Partials ? 0 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
python/paddle/nn/layer/common.py
Outdated
| embedding_dim, | ||
| ], "Shape of weight does not match num_embeddings and embedding_dim" | ||
| self._weight_attr = ParamAttr( | ||
| initializer=paddle.nn.initializer.Assign(value=_weight), |
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.
这个是不是这样可实现:
_weight.stop_gradient = _freeze
self._weight = _weight
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
python/paddle/nn/layer/common.py
Outdated
| sparse: bool = False, | ||
| _weight: Tensor | None = None, | ||
| _freeze: bool = False, | ||
| device: str | PlaceLike | None = None, |
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.
| device: str | PlaceLike | None = None, | |
| device: PlaceLike | None = None, |
PlaceLike 包含 str
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.
下同,其他地方不一一指出
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.
已修改,辛苦再review下
python/paddle/nn/layer/conv.py
Outdated
| weight_attr: ParamAttrLike | None = None, | ||
| bias_attr: ParamAttrLike | None = None, | ||
| data_format: DataLayoutND = "NCHW", | ||
| device: str | PlaceLike | None = None, |
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.
这里还没改
a2837e3
|
/re-run all-failed |
|
/re-run all-failed |
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
|
/re-run all-failed |
PR Category
User Experience
PR Types
New features
Description
add device/dtype/bias paramters for nn.Conv1/2/3D, nn.Embedding
add new api: paddle.nn.Conv1/2/3d
pcard-67164