torchsig.transforms.functional.normalize

torchsig.transforms.functional.normalize(data: ndarray, norm_order: float | Literal['fro', 'nuc'] | None = 2, flatten: bool = False) ndarray[source]

Scale data so that a specified 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 – (batch_size, vector_length, …)-sized data to be normalized.

  • norm_order – norm order to be passed to np.linalg.norm. Defaults to 2.

  • flatten – boolean specifying if the input array’s norm should be calculated on the flattened representation of the input data. Defaults to False.

Returns:

Normalized complex array data.