lfengad commented on issue #4990: [TF][Relay] BatchNorm support with run-time mean and variance calculation URL: https://github.com/apache/incubator-tvm/pull/4990#issuecomment-595611551 > > Yeah, our current implementation is just to check whether `mean` / `variance` is empty `VarNode` (with zero dimension), and then call `Mean` and `Variance` in BatchNormToInferUnpack. > > I think our pr could remove `name_hint` too. > > > if mean / variance is VarNode but with non-zero dimension, it still has the possibility to hold the given pre-defined constant values and thus cannot be replaced with Mean \ Variance. > > Could you give us an example of this condition? I could only imagine models have empty or full pre-defined values. So we should only to calculate it by calling `Mean` / `Variance` feed by `data` or our current implementation of `BatchNormToInferUnpack `. Thanks for your discussion! According to our discussion, I have rewritten the code as in the newest commit. This time, the function `BatchNormToInferUnpack` is not modified. We only modify the tensorflow frontend for `_fused_batch_norm`. If `mean` and `variance` are empty, we directly add `Mean` and `Variance` relay operators to the frontend graph before the `batch_norm` operator, without modifying the `batch_norm` operator at all. Thank you for the suggestions!
---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
