You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey @Sam-Armstrong I would like to work on this issue.
This is the code I would like to propose for the above issue...
def is_conj(input):
"""
Returns a single boolean indicating whether the entire input tensor represents conjugate values.
If the input tensor has an explicit `is_conj` attribute, this function will simply return it.
Otherwise, it will try to infer the conjugacy by checking the imaginary component of complex tensors.
"""
if hasattr(input, 'is_conj'):
# If the tensor has an explicit `is_conj` attribute, use it
return input.is_conj
else:
# If no explicit conjugacy state, infer it from the tensor data
if torch.is_complex(input):
# For complex tensors, check if the imaginary component is zero for all elements
return torch.all(torch.abs(input.imag) < 1e-8)
else:
# For real tensors, all elements are conjugate
return True
If the proposed solution is correct, should I raise the PR?
torch.Tensor.is_conj() needs to be implemented in the torch frontend in order to write a frontend for torch.resolve_conj.
cc #26935
The text was updated successfully, but these errors were encountered: