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

[ODLA/DNNL]resize support nhwc #241

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

xuhongyao
Copy link
Collaborator

No description provided.

@xuhongyao xuhongyao linked an issue Mar 22, 2021 that may be closed by this pull request
return SinkTranspose(
*inst, [new_shape, inst](IRBuilder& builder, const std::string& name,
const Def& op) {
auto new_inst = builder.CreateResize(name, {op, *new_shape});
new_inst->CopyAttrsFrom(*inst);
new_inst->SetAxesMask(-1);
Copy link
Collaborator

Choose a reason for hiding this comment

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

For NCHW, the masks are (0011), for NHWC, the masks are (0110). So there it should permute the bits for axe mask


float scale_h;
float scale_w;
std::vector<float> scales = {1.0f, 1.0f, 1.0f, 1.0f};
Copy link
Collaborator

Choose a reason for hiding this comment

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

here it can check each bit of axes_mask. if I-th bit is 0, scales[I] = 1
we don't need to worry about nhwc/nchw.

@@ -1348,11 +1348,28 @@ odla_value odla_Resize(odla_value input, odla_interpolation_mode interpolation,
auto input_md = input->mem.get_desc();
auto dt = input->mem.get_desc().data_type();

auto ret_md = dnnl::memory::desc(getDims(output_dims), dt,
dnnl::memory::format_tag::nchw);
auto format_tag = dnnl::memory::format_tag::nchw;
Copy link
Collaborator

Choose a reason for hiding this comment

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

ret_md should be the same format_tag as input_md.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[ODLA/DNNL] odla_resize not support nhwc format
3 participants