normalize#

normalize all values in a tensor according to specified method, equivalent to MATLAB’s implementation

Normalize method is defined as NORMALIZE_RANGE::method_option, available options are:#

NORMALIZE_RANGE::

Description

ZSCORE

Center data to have mean 0 and std 1

NORM

Normalizes using Lp-norm, p can be any float > 0. It defaults to p=-1 (Max norm)

SCALE

Scale data to have standard deviation 1

RANGE

rescale in range [a, b]; by default [0.0, 1.0]

CENTER

Center data to have mean 0

template<int DIM = -1, typename OpA>
__MATX_INLINE__ auto matx::normalize(const OpA &op, const NORMALIZE_RANGE normalize_method)#

Normalize operates along the first dimension of A whose size does not equal 1.

For a matrix, it normalizes along the column by default

Template Parameters:

OpA – Type of input value to normalize

Parameters:
  • op – Input value to evaluate

  • normalize_method – Method of normalization to use: ZSCORE, NORM, SCALE, RANGE, CENTER

Returns:

normalized operator

template<int DIM = -1, typename OpA>
__MATX_INLINE__ auto matx::normalize(const OpA &op, const NORMALIZE_RANGE normalize_method, const float p)#

Normalize operates along the first dimension of A whose size does not equal 1.

For a matrix, it normalizes along the column by default

Template Parameters:

OpA – Type of input value to normalize

Parameters:
  • op – Input value to evaluate

  • normalize_method – Method of normalization to use: ZSCORE, NORM, SCALE, RANGE, CENTER

  • p – for method=”NORM” specify p for Lp-norm, if unspecified max norm (infinite norm) is applied

Returns:

normalized operator

template<int DIM = -1, typename OpA>
__MATX_INLINE__ auto matx::normalize(const OpA &op, const NORMALIZE_RANGE normalize_method, const float a, const float b)#

Normalize operates along the first dimension of A whose size does not equal 1.

For a matrix, it normalizes along the column by default

Template Parameters:

OpA – Type of input value to normalize

Parameters:
  • op – Input value to evaluate

  • normalize_method – Method of normalization to use: ZSCORE, NORM, SCALE, RANGE, CENTER

  • a – start interval for range

  • b – end interval for range

Returns:

normalized operator

Examples#

(this->out_m = normalize(this->in_m, NORMALIZE_RANGE::NORM)).run(this->exec);
(this->out_m = normalize(this->in_m, NORMALIZE_RANGE::NORM, 2.0)).run(this->exec);
(this->out_m = normalize(this->in_m, NORMALIZE_RANGE::RANGE, 0.0f, 1.0f)).run(this->exec);