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

   ### Summary
   Inconsistent shapes of results produced by TVM and ONNX View due to the 
ConvTranspose operator
   
   ### Steps to Reproduce
   - ONNX View: Output Shape = (1, 6, 56, 56)
   <img width="500" height="350" alt="Screenshots" 
src="https://github.com/user-attachments/assets/8a7129b4-9ebc-47a0-aa47-6060e8df2827";
 />
   
   - TVM:  Output Shape = (1, 6, 55, 55) (due to output_padding=[0, 0])
   ```
   class Module:
       def main(input: R.Tensor((1, 3, 28, 28), dtype="float32"), weight: 
R.Tensor((3, 6, 3, 3), dtype="float32"), bias: R.Tensor((6,), dtype="float32")) 
-> R.Tensor((1, 6, 55, 55), dtype="float32"):
           R.func_attr({"num_input": 1, "params": [metadata["ffi.Tensor"][0], 
metadata["ffi.Tensor"][1]]})
           with R.dataflow():
               lv: R.Tensor((1, 6, 55, 55), dtype="float32") = 
R.nn.conv2d_transpose(input, weight, strides=[2, 2], padding=[1, 1, 1, 1], 
output_padding=[0, 0], dilation=[1, 1], groups=1, data_layout="NCHW", 
kernel_layout="IOHW", out_layout="NCHW", out_dtype="void")
               lv1: R.Tensor((1, 6, 1, 1), dtype="float32") = R.reshape(bias, 
R.shape([1, 6, 1, 1]))
               gv: R.Tensor((1, 6, 55, 55), dtype="float32") = R.add(lv, lv1)
               R.output(gv)
           return gv
   ```
   
   ### Expected
   - output_padding = [1, 1]
   ```
   class Module:
       def main(input: R.Tensor((1, 3, 28, 28), dtype="float32"), weight: 
R.Tensor((3, 6, 3, 3), dtype="float32"), bias: R.Tensor((6,), dtype="float32")) 
-> R.Tensor((1, 6, 56, 56), dtype="float32"):
           R.func_attr({"num_input": 1, "params": [metadata["ffi.Tensor"][0], 
metadata["ffi.Tensor"][1]]})
           with R.dataflow():
               lv: R.Tensor((1, 6, 56, 56), dtype="float32") = 
R.nn.conv2d_transpose(input, weight, strides=[2, 2], padding=[1, 1, 1, 1], 
output_padding=[1, 1], dilation=[1, 1], groups=1, data_layout="NCHW", 
kernel_layout="IOHW", out_layout="NCHW", out_dtype="void")
               lv1: R.Tensor((1, 6, 1, 1), dtype="float32") = R.reshape(bias, 
R.shape([1, 6, 1, 1]))
               gv: R.Tensor((1, 6, 56, 56), dtype="float32") = R.add(lv, lv1)
               R.output(gv)
           return gv
   ```
   
   ### Resolve
   - When implement converts an onnx ConvTranspose node into an equivalent 
Relax expression, get and pass output_padding param into op.
   - Fixed: #18601


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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to