You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2022/11/03 14:45:44 UTC

[GitHub] [tvm] wzh99 opened a new pull request, #13280: [Relay] Add tensor rank check for `nn.instance_norm`

wzh99 opened a new pull request, #13280:
URL: https://github.com/apache/tvm/pull/13280

   This PR adds a rank check for input tensor in type inference of `nn.instance_norm`. I explain the reasons as follows:
   
   First, according to the definition of [Instance Normalization](https://paperswithcode.com/method/instance-normalization), it only normalizes the data dimensions. Therefore, the input tensor must be of at least rank 3, and otherwise the operator will not produce meaningful results. 
   
   Second, `nn.instance_norm` with tensor rank less than 2 leads to a problem in the `SimplifyInference` optimization pass. This pass finds the reduced axes before converting the operator to its lower-level computation definition:
   https://github.com/apache/tvm/blob/f15afd225140e2a501b8b6aa2def0fd94d31bc54/src/relay/transforms/simplify_inference.cc#L149-L152
   If the rank of the input tensor is less than 3, `reduced_axes` is empty. According to `GetRealAxis`, all the dimensions are reduced:
   https://github.com/apache/tvm/blob/f15afd225140e2a501b8b6aa2def0fd94d31bc54/include/tvm/topi/reduction.h#L67-L70
   This is problematic because we do not actually want batch and `axis` dimensions to be reduced.  
   
   cc @masahi 
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tvm] masahi merged pull request #13280: [Relay] Add tensor rank check for `nn.instance_norm`

Posted by GitBox <gi...@apache.org>.
masahi merged PR #13280:
URL: https://github.com/apache/tvm/pull/13280


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [tvm] tvm-bot commented on pull request #13280: [Relay] Add tensor rank check for `nn.instance_norm`

Posted by GitBox <gi...@apache.org>.
tvm-bot commented on PR #13280:
URL: https://github.com/apache/tvm/pull/13280#issuecomment-1302223553

   <!---bot-comment-->
   
   Thanks for contributing to TVM! Please refer to the contributing guidelines https://tvm.apache.org/docs/contribute/ for useful information and tips. Please request code reviews from [Reviewers](https://github.com/apache/incubator-tvm/blob/master/CONTRIBUTORS.md#reviewers) by @-ing them in a comment.
   
   <!--bot-comment-ccs-start-->
    * No users to tag found in teams: `relay` <sub>See [#10317](https://github.com/apache/tvm/issues/10317) for details</sub><!--bot-comment-ccs-end-->
   
   <sub>Generated by [tvm-bot](https://github.com/apache/tvm/blob/main/ci/README.md#github-actions)</sub>


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org