rescale¶
- rescale(data: Tensor, resmin: int | float | Tensor | None, resmax: int | float | Tensor | None, *, srcmin: int | float | Tensor | None = None, srcmax: int | float | Tensor | None = None, dim: int | tuple[int, ...] | None = None) Tensor[source]¶
Rescales a tensor (min-max normalization).
- Parameters:
data (torch.Tensor) – tensor to rescale.
resmin (int | float | torch.Tensor | None) – minimum value for the tensor after rescaling, unchanged if
None.resmax (int | float | torch.Tensor | None) – maximum value for the tensor after rescaling, unchanged if
None.srcmin (int | float | torch.Tensor | None, optional) – minimum value for the tensor before rescaling, computed if
None. Defaults toNone.srcmax (int | float | torch.Tensor | None, optional) – maximum value for the tensor before rescaling, computed if
None. Defaults toNone.dim (int | tuple[int, ...] | None, optional) – dimension(s) along which amin/amax are computed if not provided, all dimensions if
None. Defaults toNone.
- Returns:
rescaled tensor.
- Return type: