-
Notifications
You must be signed in to change notification settings - Fork 106
Add converter for aten::_grouped_mm.default
#2805
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
base: main
Are you sure you want to change the base?
Changes from all commits
d3617b0
c540859
521dc1b
76eaefc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -23,6 +23,34 @@ | |||||
| M = 10 | ||||||
|
|
||||||
|
|
||||||
| def sample_inputs_grouped_mm(op_info, device, dtype, requires_grad, **kwargs): | ||||||
| del op_info | ||||||
| del kwargs | ||||||
|
|
||||||
| make_arg = functools.partial( | ||||||
| torch_testing.make_tensor, device=device, dtype=dtype, requires_grad=requires_grad | ||||||
| ) | ||||||
|
|
||||||
| cases = [ | ||||||
| # (G, M, K), (G, K, N) | ||||||
| ((2, 3, 4), (2, 4, 5)), | ||||||
| ((1, 2, 2), (1, 2, 1)), | ||||||
| ] | ||||||
|
|
||||||
| for self_shape, mat2_shape in cases: | ||||||
| self_t = make_arg(self_shape) | ||||||
| mat2_t = make_arg(mat2_shape) | ||||||
|
|
||||||
| # Test without bias | ||||||
| yield opinfo_core.SampleInput(self_t, args=(mat2_t,)) | ||||||
|
|
||||||
|
|
||||||
| def _mock_grouped_mm(self, mat2, offs=None, bias=None, out_dtype=None): | ||||||
Check warningCode scanning / lintrunner PYLINT/W0613 Warning test
Unused argument 'offs' (unused-argument)
See unused-argument. To disable, use # pylint: disable=unused-argument Check warningCode scanning / lintrunner PYLINT/W0613 Warning test
Unused argument 'out_dtype' (unused-argument)
See unused-argument. To disable, use # pylint: disable=unused-argument |
||||||
| res = torch.matmul(self, mat2) | ||||||
| if bias is not None: | ||||||
| res = res + bias | ||||||
|
Comment on lines
+46
to
+50
Comment on lines
+47
to
+50
|
||||||
| return res | ||||||
|
|
||||||
|
|
||||||
| def sample_inputs_scalar_tensor(op_info, device, dtype, requires_grad, **kwargs): | ||||||
| del op_info | ||||||
| del kwargs | ||||||
|
|
@@ -3144,4 +3172,12 @@ | |||||
| sample_inputs_func=sample_inputs_roi_pool, | ||||||
| supports_out=False, | ||||||
| ), | ||||||
| opinfo_core.OpInfo( | ||||||
| "ops.aten._grouped_mm", | ||||||
| aten_name="_grouped_mm", | ||||||
| op=_mock_grouped_mm, | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why not use
Suggested change
? |
||||||
| dtypes=common_dtype.floating_types(), | ||||||
| sample_inputs_func=sample_inputs_grouped_mm, | ||||||
| supports_out=False, | ||||||
| ), | ||||||
| ] | ||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you raise a not implemented error?