plenoptic.process.local_gain_release_dict#
- plenoptic.process.local_gain_release_dict(energy, state, residuals=True)[source]#
Spatially local gain release, for each element in a dictionary.
For more details, see
local_gain_release.- Parameters:
energy (
dict) – The dictionary oftorch.Tensorcontaining the local energy ofx, with shape (batch, channel, height, width) or (batch, channel, angle, height, width).state (
dict) – The dictionary oftorch.Tensorcontaining the local phase ofx.residuals (
bool(default:True)) – An option to carry around residuals in the energy dict. Note that the transformation is not applied to the residuals, that is dictionary elements with a key starting in “residual”.
- Return type:
- Returns:
coeff_dict – A dictionary containing the “gain released” tensors, with shapes matching those found in
energy.- Raises:
ValueError – If the tensors contained within
energyandstatedo not have 4 or 5 dimensions.
See also
local_gain_releaseSame operation on tensors.
local_gain_control_dictThe inverse operation.
polar_to_rectangular_dictThe analogous function for complex-valued signals.
Examples
>>> import plenoptic as po >>> import torch >>> img = po.data.einstein() >>> spyr = po.process.SteerablePyramidFreq(img.shape[-2:], height=3) >>> coeffs = spyr(img) >>> energy, state = po.process.local_gain_control_dict(coeffs) >>> coeffs_dict = po.process.local_gain_release_dict(energy, state) >>> all([torch.allclose(coeffs[k], coeffs_dict[k]) for k in coeffs.keys()]) True >>> po.plot.pyrshow(coeffs_dict) <PyrFigure size ...>