-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
[Relay, TOPI] add onehot op support #3807
Conversation
c91f213
to
4717383
Compare
tests/python/relay/test_op_level3.py
Outdated
shape_size = shape_size * src_shape[i] | ||
input_data = np.arange(shape_size, dtype=data_dtype).reshape((src_shape)) | ||
input = relay.var("input", relay.TensorType(input_data.shape, data_dtype)) | ||
on_value = relay.var("on_value", relay.TensorType((1,), value_dtype)) |
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.
use relay.scalar_type
instead
topi/include/topi/transform.h
Outdated
* | ||
* \return A Tensor whose op member is the take operation | ||
*/ | ||
inline Tensor onehot(const Tensor& a, |
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.
rename to one_hot
Worth noting that PR #3781 also implements this op and seems to have very similar changes. |
Yeah, I implemented basically the same thing in #3781. Doesn't matter to me which one is checked in, it would just be nice to get this functionality committed :) |
Sorry, this is the first time I submitted the code on the TVM community, didn't notice the previous submission #3781
You can check in the better one. we all hope to improve and use this function as soon as possible.
At 2019-08-21 06:30:53, "Jon Soifer" <[email protected]> wrote:
Yeah, I implemented basically the same thing in #3781. Doesn't matter to me which one is checked in, it would just be nice to get this functionality committed :)
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
My change to add OneHot was just checked in - feel free to give it a try! |
Closed this. You can send another PR if further changes are needed. Thanks for your contribution. |
add the onehot op support of tensorflow in Relay and Topi. Currently onehot operator supports multiple on_values/off_value/depth, and 0 <= axis < data.shape.size(). The default value: on_value=1.0, off_value=0.0, axis=-1.
@vinx13 would you be able to take a look?