torch-mlir icon indicating copy to clipboard operation
torch-mlir copied to clipboard

[RFC] Implementing aten::conv_transpose1d/2d/3d

Open gpetters94 opened this issue 3 years ago • 4 comments

Next op I'm going to work on is the aten::conv_transpose*d family. I figure decomposing them to aten::convolution and implementing the transposed case for that op is going to be the best way forward. From my research, it looks like padding and striding the input and using a normal linalg convolution is going to be the most efficient way to implement that.

gpetters94 avatar Apr 21 '22 08:04 gpetters94

An issue I'm running into with the initial prep work:

RuntimeError:                                                                                                                                                                                  
Expected a default value of type List[int] on parameter "stride".:                                                                                                                             
  File ".../mlir-npcomp/build/tools/torch-mlir/python_packages/torch_mlir/torch_mlir/dialects/torch/importer/jit_ir/build_tools/shape_lib_gen.py", line 778                       
def aten〇conv_transpose1d(input: List[int], weight: List[int], bias: Optional[List[int]] = None, stride: List[int] = (1), padding: List[int] = (0), output_padding: List[int] = (0), groups: i
nt = 1, dilation: List[int] = (1)) -> List[int]:

Changing the default values to list(1) leads to shape lib complaining that the signature doesn't match.

gpetters94 avatar Apr 21 '22 08:04 gpetters94

Can you show your changes with a PR and paste the error message?

cathyzhyi avatar Apr 21 '22 15:04 cathyzhyi

Okay, the PR is up at 775.

gpetters94 avatar Apr 21 '22 16:04 gpetters94

Not sure if this was fixed already, but I think the problem is due to the fact that in Python a single element tuple needs to have a comma after the element. For example: (1,). You could also just do [1], since the expected type is a list.

ramiro050 avatar May 03 '22 19:05 ramiro050