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


##########
python/tvm/relax/frontend/torch/exported_program_translator.py:
##########
@@ -434,6 +434,9 @@ def create_convert_map(
             "matmul.default": self._binary_op(
                 partial(relax.op.linear_algebra.matmul, out_dtype="float32"), 
operator.matmul
             ),
+            "mm.default": self._binary_op(
+                partial(relax.op.linear_algebra.matmul, out_dtype="float32"), 
operator.matmul
+            ),

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   The implementation for `mm.default` is identical to `matmul.default` (lines 
434-436) and `bmm.default` (lines 477-479). To improve maintainability and 
reduce code duplication, consider defining a common handler for these matrix 
multiplication operations and reusing it.
   
   For example:
   ```python
       matmul_handler = self._binary_op(
           partial(relax.op.linear_algebra.matmul, out_dtype="float32"), 
operator.matmul
       )
       # ...
       return {
           # ...
           "matmul.default": matmul_handler,
           "mm.default": matmul_handler,
           # ...
           "bmm.default": matmul_handler,
           # ...
       }
   ```



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