viiccwen commented on PR #19979: URL: https://github.com/apache/tvm/pull/19979#issuecomment-4942695698
Hello @tlopex, Updated the implementation. (Follow by [ONNX BatchNormalization-15 schema](https://onnx.ai/onnx/operators/onnx__BatchNormalization.html)) The strategy is: - Preserve ONNX's dtype groups: X/Y use T, scale/bias use T1, and mean/variance outputs use T2. - For the reported mixed-precision case (float16 X with float16/float32 parameters and statistics), run Relax batch_norm in float32. - Cast Y back to T and the running mean/variance back to T2. - In training mode, float16 inputs also use float32 computation, following the [ONNX requirement](https://github.com/onnx/onnx/blob/1f5f9ef9f9714c12da0adf79e2cbd49a35dab1db/onnx/defs/nn/defs.cc#L1644-L1660) to compute training statistics in float to avoid overflow. - Other mixed-dtype combinations are rejected explicitly instead of applying an unspecified general promotion policy. (can be discussed how to handle. : D) -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
