Skip to content

Commit

Permalink
Use conj_physical for torch.conj
Browse files Browse the repository at this point in the history
torch.conj sets the conjugation bit, which breaks other libraries.

Fixes #173.
  • Loading branch information
asmeurer committed Aug 6, 2024
1 parent 158622e commit f71f826
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions array_api_compat/torch/_aliases.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,9 @@ def can_cast(from_: Union[Dtype, array], to: Dtype, /) -> bool:
# Basic renames
bitwise_invert = torch.bitwise_not
newaxis = None
# torch.conj sets the conjugation bit, which breaks conversion to other
# libraries. See https://github.com/data-apis/array-api-compat/issues/173
conj = torch.conj_physical

# Two-arg elementwise functions
# These require a wrapper to do the correct type promotion on 0-D tensors
Expand Down

0 comments on commit f71f826

Please sign in to comment.