-
Notifications
You must be signed in to change notification settings - Fork 24.8k
Support torch.linalg.trace
#62714
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
Support torch.linalg.trace
#62714
Changes from 1 commit
0b91b4b
ee1901c
d8a71b4
467580b
361acf5
2edb1c8
b9a6a7e
4e96d97
5858e22
c7061ab
f98c8e9
cecc545
5f073d3
37914e4
aa1b23f
025c6e2
de21898
9986e30
cabf8dd
bf17c76
d857bd8
e5872eb
9622b99
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2575,10 +2575,14 @@ def sample_inputs_trace(self, device, dtype, requires_grad, **kwargs): | |
requires_grad=requires_grad))),) | ||
|
||
def sample_inputs_linalg_trace(self, device, dtype, requires_grad, **kwargs): | ||
# input.shape, offset | ||
inputs = ( | ||
((S, S), 0), | ||
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. What happens on empty tensors? We should probably add a case for them. What about a batched sample input too? 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. The trace function implemented in this PR returns different values from 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. Is it possible to compare then against a lambda with our same defaults that the calls into np.trace? |
||
((S, M), 0), | ||
((S, S), 1), | ||
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. Add a sample with a negative offset and a comment explaining the format of these tuples |
||
((S, S), -1), | ||
((S, S, S), 0), | ||
((S, M, L), -2), | ||
) | ||
samples = [] | ||
|
||
|
@@ -9994,7 +9998,7 @@ def ref_pairwise_distance(input1, input2): | |
sample_inputs_func=sample_inputs_linalg_slogdet, | ||
decorators=[skipCUDAIfNoMagma, skipCPUIfNoLapack],), | ||
OpInfo('linalg.trace', | ||
lezcano marked this conversation as resolved.
Show resolved
Hide resolved
|
||
ref=np.trace, | ||
ref=lambda x, offset=0: np.trace(x, offset, -2, -1), | ||
aten_name='linalg_trace', | ||
op=torch.linalg.trace, | ||
dtypes=all_types_and_complex_and(torch.bool, torch.bfloat16, torch.float16), | ||
|
Uh oh!
There was an error while loading. Please reload this page.