normalize
Functions:
| Name | Description | 
|---|---|
| batchwise_min_max_normalize | Normalize a tensor by its min and max values within each batch element. This is equivalent to using | 
| min_max_normalize | Normalize the given tensor by subtracting the minimum value and dividing by the range of its minimum value to its maximum value. | 
batchwise_min_max_normalize(tensor: Tensor) -> <class 'torch.Tensor'>
Normalize a tensor by its min and max values within each batch element. This is equivalent to using
min_max_normalize in a loop over the batch dimension.
Examples:
>>> tensor = torch.tensor([[0, 1, 2], [3, 4, 5]], dtype=torch.float32)
>>> batchwise_min_max_normalize(tensor)
tensor([[0.0000, 0.5000, 1.0000],
        [0.0000, 0.5000, 1.0000]])
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
|                    | Tensor | The tensor to normalize. | required | 
Returns:
| Type | Description | 
|---|---|
| <class 'torch.Tensor'> | The tensor, normalized batchwise. | 
Note
If the min and max values are the same along the batch dimension, nan values will be returned for that batch element.
min_max_normalize(tensor: Tensor) -> <class 'torch.Tensor'>
Normalize the given tensor by subtracting the minimum value and dividing by the range of its minimum value to its maximum value.
This is equivalent to torchvision.utils.make_grid(normalize=True). If the range is zero, the tensor is
clamped to [0, 1].
Examples:
>>> tensor = torch.tensor([[0, 1, 2], [3, 4, 5]], dtype=torch.float32)
>>> min_max_normalize(tensor)
tensor([[0.0000, 0.2000, 0.4000],
        [0.6000, 0.8000, 1.0000]])
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
|                    | Tensor | The tensor to normalize. | required | 
Returns:
| Type | Description | 
|---|---|
| <class 'torch.Tensor'> | The normalized tensor. |