MCPcopy Create free account
hub / github.com/espnet/espnet / new_complex_like

Function new_complex_like

espnet2/enh/layers/complex_utils.py:12–23  ·  view source on GitHub ↗
(
    ref: Union[torch.Tensor, ComplexTensor],
    real_imag: Tuple[torch.Tensor, torch.Tensor],
)

Source from the content-addressed store, hash-verified

10
11
12def new_complex_like(
13 ref: Union[torch.Tensor, ComplexTensor],
14 real_imag: Tuple[torch.Tensor, torch.Tensor],
15):
16 if isinstance(ref, ComplexTensor):
17 return ComplexTensor(*real_imag)
18 elif is_torch_complex_tensor(ref):
19 return torch.complex(*real_imag)
20 else:
21 raise ValueError(
22 "Please update your PyTorch version to 1.9+ for complex support."
23 )
24
25
26def is_torch_complex_tensor(c):

Callers 8

forwardMethod · 0.90
forwardMethod · 0.90
forwardMethod · 0.90
forwardMethod · 0.90
forwardMethod · 0.90
forwardMethod · 0.90
forwardMethod · 0.90
_create_mask_labelFunction · 0.90

Calls 2

is_torch_complex_tensorFunction · 0.85
complexMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…