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

[DYN][RELAY] Resize support for NCHW-convertible layouts #6293

Merged
merged 4 commits into from
Aug 26, 2020

Conversation

electriclilies
Copy link
Contributor

@icemelon9 pointed out that we can support more layouts than just NCHW and NHWC in shape functions for resize and upsampling. This PR adds support for NCHW convertible layouts to resize's shape function.

cc @mbrookhart @zhiics

Copy link
Contributor

@mbrookhart mbrookhart left a comment

Choose a reason for hiding this comment

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

Awesome! Much less hacky :)

out = [_NCHW_resize_shape_func(inputs[0].shape, inputs[1], convert(len(inputs[0].shape)))]
if nchw_pack_layout(layout) or nchw_xc_layout(layout):
out = [_resize_shape_func(inputs[0].shape, inputs[1], convert(len(inputs[0].shape)),
convert(2), convert(3), convert(1))]
Copy link
Member

Choose a reason for hiding this comment

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

Does the shape function work for NCHWc layout?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It should. The shape function copies the entire shape by iterating over ndim, so all dimensions are copied before any swapping happens.

Copy link
Member

Choose a reason for hiding this comment

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

I see.
btw. why do we need out[channel_axis] = int64(dshape[channel_axis]) since it's already copied?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I guess it is redundant, I will remove it

@jroesch jroesch merged commit 942c90b into apache:master Aug 26, 2020
trevor-m pushed a commit to trevor-m/tvm that referenced this pull request Aug 26, 2020
* fix lint

* fix typo

* remove channel_axis from resize shape func

* fix lint
trevor-m pushed a commit to trevor-m/tvm that referenced this pull request Aug 26, 2020
* fix lint

* fix typo

* remove channel_axis from resize shape func

* fix lint
trevor-m pushed a commit to trevor-m/tvm that referenced this pull request Aug 26, 2020
* fix lint

* fix typo

* remove channel_axis from resize shape func

* fix lint
trevor-m pushed a commit to trevor-m/tvm that referenced this pull request Sep 2, 2020
* fix lint

* fix typo

* remove channel_axis from resize shape func

* fix lint
trevor-m pushed a commit to neo-ai/tvm that referenced this pull request Sep 3, 2020
* fix lint

* fix typo

* remove channel_axis from resize shape func

* fix lint
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.

6 participants