Icemist commented on code in PR #13578:
URL: https://github.com/apache/tvm/pull/13578#discussion_r1043642842


##########
python/tvm/relay/frontend/onnx.py:
##########
@@ -1406,7 +1406,10 @@ def _impl_v1(cls, inputs, attr, params):
             inputs[0] *= _expr.const(alpha, dtype=dtype)
         out = _op.nn.dense(inputs[0], inputs[1], units=channels)
         if len(inputs) == 3:
-            out = out + _expr.const(beta, dtype=dtype) * inputs[2]
+            if beta != 1.0:

Review Comment:
   Since we do not use 1.0 in the calculations, I would suggest not to use it 
at all. something like:
   ```
   beta = attr.get("beta")
   ```
   ...
   ```
   if beta is None:
        out = out + inputs[2]
   else:
        out = out + _expr.const(float(beta), dtype=dtype) * inputs[2]
   ```
   
   
   or 
   ```
   input_2 = inputs[2] 
   if beta is not None:  # can be written in 1 line ternary operator
        input_2 = input_2 * expr.const(float(beta), dtype=dtype)
   out = out + input_2
   ```
   



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

Reply via email to