torchcvnn.transforms.ToReal¶
- class torchcvnn.transforms.ToReal[source]¶
Extracts the real part of a complex-valued input tensor.
The ToReal transform takes either a numpy array or a PyTorch tensor containing complex numbers and returns only their real 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 real components of each element.
- Return type:
np.ndarray | torch.Tensor
Example
>>> to_real = ToReal() >>> output = to_real(complex_tensor)
- __init__()¶
Methods
__init__()