map_range
- torchhd.map_range(input: Tensor, in_min: float, in_max: float, out_min: float, out_max: float) Tensor[source]
Maps the input real value range to an output real value range.
Note
Input values outside the min-max range are not clamped.
- Parameters:
input (Tensor) – The values to map
in_min (float) – the minimum value of the input range
in_max (float) – the maximum value of the input range
out_min (float) – the minimum value of the output range
out_max (float) – the maximum value of the output range
- Shapes:
Input: \((*)\)
Output: \((*)\)
Examples:
>>> x = torch.rand(2, 3) >>> x tensor([[0.2211, 0.1291, 0.3081], [0.7654, 0.2155, 0.4381]]) >>> functional.map_range(x, 0, 1, -10, 10) tensor([[-5.5781, -7.4176, -3.8374], [ 5.3082, -5.6906, -1.2383]])