-
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
[DYN][RELAY] Resize support for NCHW-convertible layouts #6293
Conversation
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.
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))] |
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.
Does the shape function work for NCHWc
layout?
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.
It should. The shape function copies the entire shape by iterating over ndim, so all dimensions are copied before any swapping happens.
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.
I see.
btw. why do we need out[channel_axis] = int64(dshape[channel_axis])
since it's already copied?
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.
I guess it is redundant, I will remove it
* fix lint * fix typo * remove channel_axis from resize shape func * fix lint
* fix lint * fix typo * remove channel_axis from resize shape func * fix lint
* fix lint * fix typo * remove channel_axis from resize shape func * fix lint
* fix lint * fix typo * remove channel_axis from resize shape func * fix lint
* fix lint * fix typo * remove channel_axis from resize shape func * fix lint
@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