-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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][OP] expand_dims #1819
[RELAY][OP] expand_dims #1819
Conversation
|
Please also request reviews from reviewers |
@tqchen @srkreddy1238 Hey could you help review this PR? |
Rebased to current master. |
sorry, still need another rebase after #1821 |
|
||
num_newaxis : int | ||
Number of axises to be inserted. Should be >= 0. | ||
""" |
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.
Returns
--------
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.
The result. The number of dimensions is num_newaxis greater than that of the input.
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.
@tqchen Sorry for my poor English...What does this sentence mean: "The number of dimensions is num_newaxis greater than that of the input."?
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.
maybe result_dimension = source dimension + num_newaxis
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.
@tqchen Good point! Like this?
result : relay.Expr
The reshaped result. `result.ndim = data.ndim + num_newaxis`.
Please also add the operator to https://github.com/dmlc/tvm/blob/master/docs/langref/relay_op.rst |
|
||
num_newaxis : int | ||
Number of axises to be inserted. Should be >= 0. | ||
""" |
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.
The result. The number of dimensions is num_newaxis greater than that of the input.
@tqchen Should I add examples somewhere? |
This PR contains a relay operator,
expand_dims
.TODO:
axis
in topi. Did I miss anything?expand_dims(data, axis, num_newaxis=1)
, but numpy API isexpand_dims(a, axis)
. I think it is okay because ours seem to be a superset.axis
andnum_newaxis
asint
. Wondering if it is possible to make themIndexExpr
, so thataxis
could depend on some intermediate result of computation.I am working on the docstring, and @tqchen could you help comment on the TODO 2, 3, 4?
Related issue: #1799