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

The method scale_shift_nchw in C should add shift from the values of channel #5678

Closed
tobegit3hub opened this issue May 27, 2020 · 0 comments · Fixed by #5679
Closed

The method scale_shift_nchw in C should add shift from the values of channel #5678

tobegit3hub opened this issue May 27, 2020 · 0 comments · Fixed by #5679

Comments

@tobegit3hub
Copy link
Contributor

tobegit3hub commented May 27, 2020

It is a little confused for me when reading the source code of https://github.com/apache/incubator-tvm/blob/master/topi/include/topi/nn/mapping.h#L51 . The scale_shift_nchw and scale_shift_nhwc should apply scale and shift from the values of channel. There is another implementation in Python topi which seems to be right in https://github.com/apache/incubator-tvm/blob/master/topi/python/topi/nn/mapping.py#L44 .

Should we change the implementation of scale_shift_nchw to this?

inline Tensor scale_shift_nchw(const Tensor& x, const Tensor& scale, const Tensor& shift,
                               std::string name = "ScaleShift", std::string tag = kBroadcast) {
  return tvm::te::compute(
      x->shape, [&](Var b, Var c, Var h, Var w) { return x(b, c, h, w) * scale(c) + shift(c); },
      name, tag);
}
@tobegit3hub tobegit3hub changed the title The method scale_shift_nchw in C should add shift to the values of channel The method scale_shift_nchw in C should add shift from the values of channel May 27, 2020
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 a pull request may close this issue.

1 participant