gemini-code-assist[bot] commented on code in PR #18704:
URL: https://github.com/apache/tvm/pull/18704#discussion_r2753610825


##########
python/tvm/relax/frontend/onnx/onnx_frontend.py:
##########
@@ -2435,8 +2435,18 @@ def _impl_v15(cls, bb, inputs, attr, params):
         mean = inputs[3]
         var = inputs[4]
         epsilon = attr.get("epsilon", 1e-05)
+        momentum = attr.get("momentum", 0.9)
+        training_mode = attr.get("training_mode", 0)
         return relax.op.nn.batch_norm(
-            data, gamma=scale, beta=bias, moving_mean=mean, moving_var=var, 
epsilon=epsilon, axis=1
+            data,
+            gamma=scale,
+            beta=bias,
+            moving_mean=mean,
+            moving_var=var,
+            axis=1,
+            epsilon=epsilon,
+            momentum=momentum,
+            training=training_mode,

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   For clarity and type safety, it's better to explicitly cast `training_mode` 
to a boolean. The `training` parameter of `relax.op.nn.batch_norm` expects a 
boolean, and while Python's truthiness handles the integer `0` or `1` 
correctly, an explicit cast makes the intent clearer and guards against 
potential issues if the operator's signature becomes stricter in the future.
   
   ```suggestion
               training=bool(training_mode),
   ```



-- 
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]

Reply via email to