plenoptic.process.rescale#
- plenoptic.process.rescale(x, a=0.0, b=1.0)[source]#
Linearly rescale the dynamic range of the input to
[a, b].- Parameters:
- Return type:
- Returns:
rescaled_x – The rescaled tensor.
Examples
>>> import plenoptic as po >>> import torch >>> x = torch.tensor([2.0, 4.0, 6.0, 8.0]) >>> po.process.rescale(x) tensor([0.0000, 0.3333, 0.6667, 1.0000]) >>> po.process.rescale(x, a=-1, b=1) tensor([-1.0000, -0.3333, 0.3333, 1.0000])