Skip to content
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

[FRONTEND][MXNET] Add squeeze_axis support to split operator #1288

Merged
merged 6 commits into from
Jun 20, 2018

Conversation

nishi-t
Copy link
Contributor

@nishi-t nishi-t commented Jun 15, 2018

In mxnet, split symbol has squeeze_axis option. This PR adds it to topi and nnvm. please review.

https://mxnet.incubator.apache.org/api/python/symbol/symbol.html#mxnet.symbol.split

@PariksheetPinjari909
Copy link
Contributor

Topi already support squeeze operation, please check whether you can use it for your purpose.

@nishi-t
Copy link
Contributor Author

nishi-t commented Jun 15, 2018

@PariksheetPinjari909 Thanks for your comment. I used squeeze operator to support split with squeeze_axis in topi. Could you review again?

@tqchen
Copy link
Member

tqchen commented Jun 15, 2018

A better way would be directly modify the translator to translate to combination of squeeze then split operation

@nishi-t
Copy link
Contributor Author

nishi-t commented Jun 16, 2018

@tqchen I understand that it is better to modify the translator (mxnet frontend), but couldn't do it. I look like it is difficult to simply apply squeeze symbol after split symbol at there, because the output of split is split matrices (these are unsitable as the input of squeeze). Also vice versea, I look like it is not available to apply squeeze before split.
Please, let me know if you know of any better way or the point that I missed.

@tqchen
Copy link
Member

tqchen commented Jun 16, 2018

@nishi-t It might be possible to get each output of the split, and apply squeeze separately on each output?

@zhreshold can you comment on this as well?

@zhreshold
Copy link
Member

I think it is possible to slice the output of split and apply squeeze one by one because you have num_outputs already

@tqchen tqchen requested a review from zhreshold June 16, 2018 22:27

@tvm.tag_scope(tag=tag.INJECTIVE)
def split(ary, indices_or_sections, axis=0):
def __split(ary, indices_or_sections, axis=0):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

single _ ?

@tqchen tqchen added status: review in progress status: need update need update based on feedbacks labels Jun 17, 2018
@nishi-t
Copy link
Contributor Author

nishi-t commented Jun 18, 2018

@tqchen @zhreshold thanks for you comments.

It might be possible to get each output of the split, and apply squeeze separately on each output

Ok, I'll try it.

@nishi-t nishi-t changed the title [TOPI][NNVM][MXNET] Add squeeze_axis support to split operator [MXNET] Add squeeze_axis support to split operator Jun 18, 2018
@nishi-t nishi-t changed the title [MXNET] Add squeeze_axis support to split operator [FRONTEND][MXNET] Add squeeze_axis support to split operator Jun 18, 2018
@nishi-t
Copy link
Contributor Author

nishi-t commented Jun 18, 2018

I addressed the comment. Please review again.

if _parse_bool_str(attrs, 'squeeze_axis'):
squeeze_attrs = {'axis': axis}
for o in outputs:
o = _get_nnvm_op('squeeze')(o, **squeeze_attrs)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are you sure this can be replaced in-place?

Copy link
Contributor Author

@nishi-t nishi-t Jun 19, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, it was my mistake. Thank you for pointing that out. This couldn't be replaced in-place. I'll fix it, but I'll need to find how to update the split symbol with squeeze. Please let me know if you have any good ideas.

@nishi-t
Copy link
Contributor Author

nishi-t commented Jun 20, 2018

@zhreshold I tried using Group for my purpose. Could you review this again?

@zhreshold
Copy link
Member

LGTM now, thanks.

@tqchen tqchen merged commit a6ce6c5 into apache:master Jun 20, 2018
@tqchen
Copy link
Member

tqchen commented Jun 20, 2018

Thanks for all the reviewers and the contributor in improving the change. This is now merged

sergei-mironov pushed a commit to sergei-mironov/tvm that referenced this pull request Aug 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants