complextorch.nn.modules.upsampling#
Two flavors of complex-valued upsampling / interpolation:
Upsample— split form. Interpolates the real and imaginary parts independently. Matches the behavior oftorchcvnn.nn.UpsampleandcomplexPyTorch.complex_upsample.PolarUpsample— polar form. Interpolates the magnitude \(|z|\) and the phase \(\arg z\) independently, then recombines via \(|z| \cdot \exp(j\,\arg z)\). Phase-preserving along smooth phase regions; useful for coherent signal models (radar, SAR). The cost is a visible discontinuity wherever the phase wraps from \(-\pi\) to \(+\pi\) — neither form is universally correct.
Classes#
Complex-Valued Upsample (polar form) |
|
Complex-Valued Upsample (split form) |
Module Contents#
- class complextorch.nn.modules.upsampling.PolarUpsample(size: _SizeT = None, scale_factor: float | tuple[float, Ellipsis] | None = None, mode: str = 'nearest', align_corners: bool | None = None, recompute_scale_factor: bool | None = None)[source]#
Bases:
torch.nn.ModuleComplex-Valued Upsample (polar form)#
Interpolates magnitude and phase independently. For a complex input \(z = |z|\, e^{j\arg z}\):
\[|z|' = \text{interp}(|z|), \quad \arg z' = \text{interp}(\arg z), \quad z' = |z|' \cdot e^{j\,\arg z'}\]Phase-preserving along smooth phase regions but introduces discontinuities at phase wraps (\(\pm\pi\)). Choose between
Upsample(split) andPolarUpsample(polar) based on whether your data has smooth phase (favor polar) or smooth real/imag parts (favor split).All keyword arguments mirror
torch.nn.Upsample.Initialize internal Module state, shared by both nn.Module and ScriptModule.
- extra_repr() str[source]#
Return the extra representation of the module.
To print customized extra information, you should re-implement this method in your own modules. Both single-line and multi-line strings are acceptable.
- forward(input: torch.Tensor) torch.Tensor[source]#
- align_corners = None#
- mode = 'nearest'#
- recompute_scale_factor = None#
- scale_factor = None#
- size = None#
- class complextorch.nn.modules.upsampling.Upsample(size: _SizeT = None, scale_factor: float | tuple[float, Ellipsis] | None = None, mode: str = 'nearest', align_corners: bool | None = None, recompute_scale_factor: bool | None = None)[source]#
Bases:
torch.nn.ModuleComplex-Valued Upsample (split form)#
Applies
torch.nn.functional.interpolate()independently to the real and imaginary parts of a complex input, then recombines.All keyword arguments mirror
torch.nn.Upsample.Initialize internal Module state, shared by both nn.Module and ScriptModule.
- extra_repr() str[source]#
Return the extra representation of the module.
To print customized extra information, you should re-implement this method in your own modules. Both single-line and multi-line strings are acceptable.
- forward(input: torch.Tensor) torch.Tensor[source]#
- align_corners = None#
- mode = 'nearest'#
- recompute_scale_factor = None#
- scale_factor = None#
- size = None#