[Zero-Dim] Support input 0D Tensor for masked_select by ZzSean · Pull Request #49803 · PaddlePaddle/Paddle
你的PR提交成功,感谢你对开源项目的贡献!
请关注后续CI自动化测试结果,详情请参考Paddle-CI手册。
Your PR has been submitted. Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.
|
|
||
| y.backward() | ||
|
|
||
| self.assertEqual(y.shape, [1]) |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
加下y的具体值的测试吧,与x相等
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, []) |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
加下x.grad的具体值的测试吧
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() |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
拉下最新的,需要y.retain_grads()
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done,thx
|
|
||
| self.assertEqual(res[0].shape, ()) | ||
|
|
||
| @prog_scope() |
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())
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done, thx
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This file contains hidden or 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