-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
[Zero-Dim] Support input 0D Tensor for masked_select #49803
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
|
||
y.backward() | ||
|
||
self.assertEqual(y.shape, [1]) |
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.
加下y的具体值的测试吧,与x相等
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.
done
y.backward() | ||
|
||
self.assertEqual(y.shape, [1]) | ||
self.assertEqual(x.grad.shape, []) |
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.
加下x.grad的具体值的测试吧
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.
done
mask = paddle.full([], True, dtype='bool') | ||
y = paddle.masked_select(x, mask) | ||
|
||
y.backward() |
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.
拉下最新的,需要y.retain_grads()
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.
done,thx
@@ -1968,6 +1982,16 @@ def test_atan2(self): | |||
|
|||
self.assertEqual(res[0].shape, ()) | |||
|
|||
@prog_scope() |
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.static.append_backward(out.sum())
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.
done, thx
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 types
New features
PR changes
APIs
Describe
masked_select支持0D tensor