jikechao opened a new pull request, #14885:
URL: https://github.com/apache/tvm/pull/14885

   `broadcast_shapes` is a newly introduced operator after PyTorch 1.8.0. If 
you install PyTorch < 1.8.0, the usage `torch.broadcast_shapes` will lead to a 
crash and throw:   **AttributeError: module 'torch' has no attribute 
'broadcast_shapes'**.
   
   This PR replaces `broadcast_shapes` with an old operator 
`broadcast_tensors`, which was introduced since PyTorch 1.0.0.
   
   ### Reference: [PyTorch Documentation](
   ![Uploading image.png…]()
   )
   
![image](https://github.com/apache/tvm/assets/29506758/63138b14-de75-4b6a-80ec-9cb0f6252d11)
   
   
   
   
   
   ### Reproducible script
   ```
   import torch
   from tvm import relay
   import tvm
   
   m = torch.nn.L1Loss()
   input_shape_ = [10, 3]
   input_data=[torch.randn(input_shape_, dtype=torch.float64), 
torch.randn(input_shape_, dtype=torch.float64)]
   trace = torch.jit.trace(m, input_data)
   
   #input_shapes = [('input0', torch.Size(input_shape))]
   input_shapes = [('input0', torch.Size(input_shape_)), ('input1', 
torch.Size(input_shape_))]
   mod, params = relay.frontend.from_pytorch(trace, input_shapes)
   
   with tvm.transform.PassContext(opt_level=3):
       exe = relay.create_executor('vm', mod=mod, params=params, 
device=tvm.device('llvm', 0), target='llvm').evaluate()
   ```
   
   
   BTW, this bug can be triggered by existing test cases. Thus, we needn't add 
new test cases.


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