meddlr.ops.complex.is_complex_as_real#

meddlr.ops.complex.is_complex_as_real(x)[source]#

Returns True if the tensor follows the real-view convention for complex numbers.

The real-view of a complex tensor has the shape […, 2].

Parameters

x (torch.Tensor) – A tensor.

Returns

True if the tensor follows the real-view convention

for complex numbers.

Return type

bool

Note

We recommend using complex tensors instead of the real-view convention. This function cannot interpret if the last dimension has a size of 2 because it is the real-imaginary channel or for some other reason.