torchcvnn.transforms.RandomPhase¶
- class torchcvnn.transforms.RandomPhase(dtype: str, centering: bool = False)[source]¶
Randomly phase-shifts complex-valued input data. This transform applies a random phase shift to complex-valued input tensors/arrays by multiplying the input with exp(j*phi), where phi is uniformly distributed in [0, 2π] or [-π, π] if centering is enabled. :param dtype: str
Data type for the output. Must be one of the supported complex dtypes.
- Parameters:
centering – bool, optional. If True, centers the random phase distribution around 0 by subtracting π from the generated phases. Default is False.
- Returns
- torch.Tensor or numpy.ndarray
Phase-shifted complex-valued data with the same shape as input.
- Examples
>>> transform = RandomPhase(dtype='complex64') >>> x = torch.ones(3,3, dtype=torch.complex64) >>> output = transform(x) # Applies random phase shifts
- Notes
Input data must be complex-valued
The output maintains the same shape and complex dtype as input
- Phase shifts are uniformly distributed in:
[0, 2π] when centering=False
[-π, π] when centering=True
Methods
__init__
(dtype[, centering])