Skip to content

Add tests for atleast_2d op #4045

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
2 changes: 2 additions & 0 deletions projects/pt1/e2e_testing/xfail_sets.py
Original file line number Diff line number Diff line change
Expand Up @@ -995,6 +995,7 @@
"Atleast2dModule0dInput_basic",
"Atleast2dModule1dInput_basic",
"Atleast2dModule2dInput_basic",
"Atleast2dModule3dInput_basic",
"AtenLinear1D_basic",
"AtenLinear2D_basic",
"AtenLinear3DBias_basic",
Expand Down Expand Up @@ -1997,6 +1998,7 @@
"Atleast2dModule0dInput_basic",
"Atleast2dModule1dInput_basic",
"Atleast2dModule2dInput_basic",
"Atleast2dModule3dInput_basic",
"AtenLinear2D_basic",
"AtenLinear3DBias_basic",
"ElementwiseAddScalar_NumToTensorFloat_Module_basic",
Expand Down
48 changes: 48 additions & 0 deletions projects/pt1/python/torch_mlir_e2e_test/test_suite/reshape_like.py
Original file line number Diff line number Diff line change
Expand Up @@ -1551,6 +1551,54 @@ def Atleast1dModule1dInput_basic(module, tu: TestUtils):
module.forward(tu.rand(4))


class Atleast2dModule0dInput(torch.nn.Module):
@export
@annotate_args([None, [(), torch.float32, True]])
def forward(self, x):
return torch.ops.aten.atleast_2d(x)


@register_test_case(module_factory=lambda: Atleast2dModule0dInput())
def Atleast2dModule0dInput_basic(module, tu: TestUtils):
module.forward(tu.rand())


class Atleast2dModule1dInput(torch.nn.Module):
@export
@annotate_args([None, [(10,), torch.float32, True]])
def forward(self, x):
return torch.ops.aten.atleast_2d(x)


@register_test_case(module_factory=lambda: Atleast2dModule1dInput())
def Atleast2dModule1dInput_basic(module, tu: TestUtils):
module.forward(tu.rand(10))


class Atleast2dModule2dInput(torch.nn.Module):
@export
@annotate_args([None, [(3, 4), torch.float32, True]])
def forward(self, x):
return torch.ops.aten.atleast_2d(x)


@register_test_case(module_factory=lambda: Atleast2dModule2dInput())
def Atleast2dModule2dInput_basic(module, tu: TestUtils):
module.forward(tu.rand(3, 4))


class Atleast2dModule3dInput(torch.nn.Module):
@export
@annotate_args([None, [(2, 3, 4), torch.float32, True]])
def forward(self, x):
return torch.ops.aten.atleast_2d(x)


@register_test_case(module_factory=lambda: Atleast2dModule3dInput())
def Atleast2dModule3dInput_basic(module, tu: TestUtils):
result = module.forward(tu.rand(2, 3, 4))


# ==============================================================================


Expand Down