torchsig.transforms.functional.normalize

torchsig.transforms.functional.normalize(data: ndarray, norm_order: float | int | Literal['fro', 'nuc'] | None = 2, flatten: bool = False) ndarray[source]
Scale data so that a specfied norm computes to 1. For detailed information, see numpy.linalg.norm.()
  • For norm=1, norm = max(sum(abs(x), axis=0)) (sum of the elements)

  • for norm=2, norm = sqrt(sum(abs(x)^2), axis=0) (square-root of the sum of squares)

  • for norm=np.inf, norm = max(sum(abs(x), axis=1)) (largest absolute value)

Parameters:
  • data (np.ndarray) – (batch_size, vector_length, …)-sized data to be normalized.

  • norm_order (int) – norm order to be passed to np.linalg.norm

  • flatten (bool) – boolean specifying if the input array’s norm should be calculated on the flattened representation of the input data

Returns:

Normalized complex array data.

Return type:

np.ndarray