Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions python/tvm/relax/frontend/torch/base_fx_graph_translator.py
Original file line number Diff line number Diff line change
Expand Up @@ -733,6 +733,7 @@ def _conv_transpose1d_impl(
padding: Optional[Tuple],
dilation: Optional[Tuple],
groups: Optional[Tuple],
output_padding: Optional[Tuple],
) -> relax.Var:
conv1d_transpose = self.block_builder.emit(
relax.op.nn.conv1d_transpose(
Expand All @@ -742,8 +743,9 @@ def _conv_transpose1d_impl(
padding=padding,
dilation=dilation,
groups=groups,
output_padding=output_padding,
data_layout="NCW",
kernel_layout="OIW",
kernel_layout="IOW",
out_dtype="float32",
)
)
Expand All @@ -762,8 +764,9 @@ def _conv_transpose1d(self, node: fx.Node) -> relax.Var:
bias = args[2] if len(args) > 2 else None
stride = args[3] if len(args) > 3 else 1
padding = args[4] if len(args) > 4 else 0
dilation = args[5] if len(args) > 5 else 1
output_padding = args[5] if len(args) > 5 else 0
groups = args[6] if len(args) > 6 else 1
dilation = args[7] if len(args) > 7 else 1
return self._conv_transpose1d_impl(
x,
weight,
Expand All @@ -772,6 +775,7 @@ def _conv_transpose1d(self, node: fx.Node) -> relax.Var:
padding=padding,
dilation=dilation,
groups=groups,
output_padding=output_padding,
)

def _conv_transpose2d_impl(
Expand All @@ -783,6 +787,7 @@ def _conv_transpose2d_impl(
padding: Optional[Tuple],
dilation: Optional[Tuple],
groups: Optional[Tuple],
output_padding: Optional[Tuple],
) -> relax.Var:
conv2d_transpose = self.block_builder.emit(
relax.op.nn.conv2d_transpose(
Expand All @@ -792,8 +797,9 @@ def _conv_transpose2d_impl(
padding=padding,
dilation=dilation,
groups=groups,
output_padding=output_padding,
data_layout="NCHW",
kernel_layout="OIHW",
kernel_layout="IOHW",
out_dtype="float32",
)
)
Expand All @@ -812,8 +818,9 @@ def _conv_transpose2d(self, node: fx.Node) -> relax.Var:
bias = args[2] if len(args) > 2 else None
stride = args[3] if len(args) > 3 else 1
padding = args[4] if len(args) > 4 else 0
dilation = args[5] if len(args) > 5 else 1
output_padding = args[5] if len(args) > 5 else 0
groups = args[6] if len(args) > 6 else 1
dilation = args[7] if len(args) > 7 else 1
return self._conv_transpose2d_impl(
x,
weight,
Expand All @@ -822,6 +829,7 @@ def _conv_transpose2d(self, node: fx.Node) -> relax.Var:
padding=padding,
dilation=dilation,
groups=groups,
output_padding=output_padding,
)

def _conv1d_impl(
Expand Down
2 changes: 2 additions & 0 deletions python/tvm/relax/frontend/torch/fx_translator.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,7 @@ def _conv_transpose1d_module(self, node: fx.Node) -> relax.Var:
padding=module.padding,
dilation=module.dilation,
groups=module.groups,
output_padding=module.output_padding,
)

def _conv_transpose2d_module(self, node: fx.Node) -> relax.Var:
Expand All @@ -310,6 +311,7 @@ def _conv_transpose2d_module(self, node: fx.Node) -> relax.Var:
padding=module.padding,
dilation=module.dilation,
groups=module.groups,
output_padding=module.output_padding,
)

def _conv1d_module(self, node: fx.Node) -> relax.Var:
Expand Down
12 changes: 8 additions & 4 deletions tests/python/relax/test_frontend_from_exported_program.py
Original file line number Diff line number Diff line change
Expand Up @@ -1870,9 +1870,10 @@ def main(
w1,
strides=[1],
padding=[0, 0],
output_padding=[0],
dilation=[1],
data_layout="NCW",
kernel_layout="OIW",
kernel_layout="IOW",
out_layout="NCW",
out_dtype="float32",
)
Expand Down Expand Up @@ -1904,9 +1905,10 @@ def main(
w1,
strides=[1],
padding=[0, 0],
output_padding=[0],
dilation=[1],
data_layout="NCW",
kernel_layout="OIW",
kernel_layout="IOW",
out_layout="NCW",
out_dtype="float32",
)
Expand Down Expand Up @@ -1962,9 +1964,10 @@ def main(
w1,
strides=[1, 1],
padding=[0, 0, 0, 0],
output_padding=[0, 0],
dilation=[1, 1],
data_layout="NCHW",
kernel_layout="OIHW",
kernel_layout="IOHW",
out_layout="NCHW",
out_dtype="float32",
)
Expand Down Expand Up @@ -1996,9 +1999,10 @@ def main(
w1,
strides=[1, 1],
padding=[0, 0, 0, 0],
output_padding=[0, 0],
dilation=[1, 1],
data_layout="NCHW",
kernel_layout="OIHW",
kernel_layout="IOHW",
out_layout="NCHW",
out_dtype="float32",
)
Expand Down
12 changes: 8 additions & 4 deletions tests/python/relax/test_frontend_from_fx.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,10 @@ def main(
w1,
strides=[1],
padding=[0, 0],
output_padding=[0],
dilation=[1],
data_layout="NCW",
kernel_layout="OIW",
kernel_layout="IOW",
out_layout="NCW",
out_dtype="float32",
)
Expand Down Expand Up @@ -202,9 +203,10 @@ def main(
w1,
strides=[1],
padding=[0, 0],
output_padding=[0],
dilation=[1],
data_layout="NCW",
kernel_layout="OIW",
kernel_layout="IOW",
out_layout="NCW",
out_dtype="float32",
)
Expand Down Expand Up @@ -352,9 +354,10 @@ def main(
w1,
strides=[1, 1],
padding=[0, 0, 0, 0],
output_padding=[0, 0],
dilation=[1, 1],
data_layout="NCHW",
kernel_layout="OIHW",
kernel_layout="IOHW",
out_layout="NCHW",
out_dtype="float32",
)
Expand Down Expand Up @@ -386,9 +389,10 @@ def main(
w1,
strides=[1, 1],
padding=[0, 0, 0, 0],
output_padding=[0, 0],
dilation=[1, 1],
data_layout="NCHW",
kernel_layout="OIHW",
kernel_layout="IOHW",
out_layout="NCHW",
out_dtype="float32",
)
Expand Down