Skip to content

Commit f71f826

Browse files
committed
Use conj_physical for torch.conj
torch.conj sets the conjugation bit, which breaks other libraries. Fixes #173.
1 parent 158622e commit f71f826

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

array_api_compat/torch/_aliases.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,9 @@ def can_cast(from_: Union[Dtype, array], to: Dtype, /) -> bool:
145145
# Basic renames
146146
bitwise_invert = torch.bitwise_not
147147
newaxis = None
148+
# torch.conj sets the conjugation bit, which breaks conversion to other
149+
# libraries. See https://github.com/data-apis/array-api-compat/issues/173
150+
conj = torch.conj_physical
148151

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

0 commit comments

Comments
 (0)