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
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@ def create_convert_map(
# tensor creation
"_to_copy.default": self._to_copy,
"arange.start": self._arange,
"contiguous.default": lambda node: self.env[node.args[0]], # no-op
"clone.default": lambda node: self.env[node.args[0]],
"empty.memory_format": self._empty,
"fill.Scalar": self._fill,
Expand Down
20 changes: 20 additions & 0 deletions tests/python/relax/test_frontend_from_exported_program.py
Original file line number Diff line number Diff line change
Expand Up @@ -2930,6 +2930,26 @@ def main(
verify_model(Arange(), example_args, {}, Expected)


def test_contiguous():
class Contiguous(Module):
def forward(self, input):
return input.contiguous()

@tvm.script.ir_module
class Expected:
@R.function
def main(
input: R.Tensor((10, 10), dtype="float32"),
) -> R.Tuple(R.Tensor((10, 10), dtype="float32")):
with R.dataflow():
gv: R.Tuple(R.Tensor((10, 10), dtype="float32")) = (input,)
R.output(gv)
return gv

example_args = (torch.randn(10, 10, dtype=torch.float32),)
verify_model(Contiguous(), example_args, {}, Expected)


def test_clone():
class Clone(Module):
def forward(self, input):
Expand Down