Skip to content

Add support for aten.min.dim #12623

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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: 1 addition & 1 deletion backends/qualcomm/builders/op_min.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

@register_node_visitor
class Min(NodeVisitor):
target = ["aten.minimum.default"]
target = ["aten.minimum.default", "aten.min.dim"]

def __init__(self, *args) -> None:
super().__init__(*args)
Expand Down
9 changes: 9 additions & 0 deletions backends/qualcomm/tests/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1162,6 +1162,15 @@ def forward(self, x, y):
return torch.minimum(x, y)


class MinDim(torch.nn.Module):
def __init__(self):
super().__init__()

def forward(self, logits):
min_logits, min_indices = torch.min(logits, dim=1)
return min_logits, min_indices


class Mul(torch.nn.Module):
def __init__(self):
super().__init__()
Expand Down
5 changes: 5 additions & 0 deletions backends/qualcomm/tests/test_qnn_delegate.py
Original file line number Diff line number Diff line change
Expand Up @@ -884,6 +884,11 @@ def test_qnn_backend_minimum(self):
sample_input = (torch.randn(1, 2, 3, 4), torch.randn(2, 3, 4))
self.lower_module_and_test_output(module, sample_input)

def test_qnn_backend_min_dim(self):
module = MinDim() # noqa: F405
sample_input = (torch.randn(4, 10), )
self.lower_module_and_test_output(module, sample_input)

def test_qnn_backend_neg(self):
module = Neg() # noqa: F405
sample_input = (torch.randn(1, 4, 16, 16),)
Expand Down
Loading