Hzfengsy commented on code in PR #17918:
URL: https://github.com/apache/tvm/pull/17918#discussion_r2082811138


##########
python/tvm/relax/frontend/torch/fx_translator.py:
##########
@@ -639,9 +639,7 @@ def create_convert_map(
             nn.LogSoftmax: self._log_softmax_module,
             nn.PReLU: self._prelu_module,
             nn.ReLU: self._unary_op(relax.op.nn.relu),
-            nn.ReLU6: lambda node: self.block_builder.emit(
-                relax.op.clip(self.env[node.args[0]], 0, 6)
-            ),
+            nn.ReLU6: self._unary_op(relax.op.nn.relu6),

Review Comment:
   Thanks for explaining it. My concern is that relu6 should not be a relax 
operator as it can be represented by other ops (i.e. clip). 
   
   We can keep the `relax.op.nn.relu6` interface as a sugar, but not register a 
new relax op. 
   To be clear, it's better to remove the new definition in:
   - src/relax/op/nn/nn.cc
   - src/relax/op/nn/nn.h
   - src/contrib/msc/framework/tvm/relax_opcode.cc
   - python/tvm/topi/nn/elemwise.py
   - python/tvm/relax/transform/legalize_ops/
   
   And change the codes in python/tvm/relax/op/nn/nn.py
   ```python
   return relax.op.clip(data, 0, 6)
   ```



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