masahi commented on code in PR #11863:
URL: https://github.com/apache/tvm/pull/11863#discussion_r905654191


##########
python/tvm/relay/frontend/pytorch.py:
##########
@@ -1952,6 +1952,13 @@ def expand_as(self, inputs, input_types):
             target = _op.cast(target, t0)
         return _op.broadcast_to_like(inputs[0], target)
 
+    def broadcast_tensors(self, inputs, input_types):
+        tensor_list = inputs[0]
+        import torch
+
+        res_shape = list(torch.broadcast_shapes(*[self.infer_shape(t) for t in 
tensor_list]))
+        return [_op.broadcast_to(tensor, res_shape) for tensor in tensor_list]

Review Comment:
   oh interesting. Have you verified that this is what `broadcast_tensors` 
does? It's interesting that we are actually invoking pytorch function for 
conversion purpose.



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