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
Add masked select module #5356
Add masked select module #5356
Conversation
broadcast_like_tensor = flow.experimental.zeros( | ||
tuple(broadcast_like_shape), dtype=flow.float32 | ||
) | ||
broadcast_like_tensor = broadcast_like_tensor.to(x.device.type) |
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.
这一步可以在flow.experimental.zeros里完成
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 = flow.Tensor(np.array([[-0.4620, 0.3139], [0.3898, -0.7197], [0.0478, -0.1657]]), dtype=flow.float32) | ||
>>> mask = x.gt(0.05) | ||
>>> of_out = flow.masked_select(x, mask) |
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.
of_out怪怪的,用y或者out就行
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.
好的
…-Inc/oneflow into add_masked_select_module
添加masked_select module:
doctest:
docstring:
单测: