Skip to content

Commit

Permalink
[install] torch.complex32 has been removed from 1.11.0
Browse files Browse the repository at this point in the history
According to pytorch/pytorch#72721 complex32
will be brought back in a later version, the check should be removed
then.
  • Loading branch information
ben-freist committed Mar 16, 2022
1 parent 25b03c7 commit 51bbc2a
Showing 1 changed file with 8 additions and 13 deletions.
21 changes: 8 additions & 13 deletions asteroid/dsp/beamforming.py
Original file line number Diff line number Diff line change
Expand Up @@ -472,15 +472,6 @@ def _generalized_eigenvalue_decomposition(a, b):
e_vec = torch.matmul(inv_cholesky.conj().transpose(-1, -2), e_vec)
return e_val, e_vec


_to_double_map = {
torch.float16: torch.float64,
torch.float32: torch.float64,
torch.complex32: torch.complex128,
torch.complex64: torch.complex128,
}


def _common_dtype(*args):
all_dtypes = [a.dtype for a in args]
if len(set(all_dtypes)) > 1:
Expand All @@ -502,20 +493,24 @@ def force_double_linalg():


def _precision_mapping():
has_complex32 = hasattr(torch, "complex32")
if USE_DOUBLE:
return {
precision_map = {
torch.float16: torch.float64,
torch.float32: torch.float64,
torch.complex32: torch.complex128,
torch.complex64: torch.complex128,
}
if has_complex32:
precision_map[torch.complex32] = torch.complex128
else:
return {
precision_map = {
torch.float16: torch.float16,
torch.float32: torch.float32,
torch.complex32: torch.complex32,
torch.complex64: torch.complex64,
}
if has_complex32:
precision_map[torch.complex32] = torch.complex32
return precision_map


# Legacy
Expand Down

0 comments on commit 51bbc2a

Please sign in to comment.