torchcvnn.transforms.ToImaginary¶
- class torchcvnn.transforms.ToImaginary[source]¶
Extracts the imaginary part of a complex-valued input tensor.
The ToImaginary transform takes either a numpy array or a PyTorch tensor containing complex numbers and returns only their imaginary parts. If the input is already real-valued, it remains unchanged.
- Returns:
- A tensor with the same shape as the input but containing only
the imaginary components of each element.
- Return type:
np.ndarray | torch.Tensor
Example
>>> to_imaginary = ToImaginary() >>> output = to_imaginary(complex_tensor)
- __init__()¶
Methods
__init__()