-
Notifications
You must be signed in to change notification settings - Fork 5.8k
【BUPT】[Paddle Tensor 第二期 API 支持 0-size Tensor] paddle.unstack 支持 0-size tensor #70342
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提交成功,感谢你对开源项目的贡献! |
auto x_grad_dim = (outs)[i]->dims(); | ||
(outs)[i]->Resize(x_grad_dim); |
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.
auto x_grad_dim = (outs)[i]->dims(); | |
(outs)[i]->Resize(x_grad_dim); | |
(outs)[i]->Resize((outs)[i]->dims()); |
test/legacy_test/test_unstack_op.py
Outdated
self._test_unstack_with_shapes((0, 11, 22), axis=-2) | ||
|
||
def _test_unstack_with_static_empty_tensor_input(self, place): | ||
paddle.enable_static() |
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.
静态图和动态图的模式切换使用with dygraph_guard()和with static_guard():,代替enable/disable_static
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.
LGTM
PR Category
User Experience
PR Types
Bug fixes
Description
paddle.unstack
提供 0-size tensor 输入的支持numpy.unstack
,测试里使用的是与其等效的tuple(np.moveaxis(x, axis, 0))