module onnxrt.ops_cpu.op_normalizer#

Inheritance diagram of mlprodict.onnxrt.ops_cpu.op_normalizer

Short summary#

module mlprodict.onnxrt.ops_cpu.op_normalizer

Runtime operator.

source on GitHub

Classes#

class

truncated documentation

Normalizer

Normalizer (ai.onnx.ml) ======================= Normalize the input. There are three normalization modes, which have …

Properties#

property

truncated documentation

args_default

Returns the list of arguments as well as the list of parameters with the default values (close to the signature). …

args_default_modified

Returns the list of modified parameters.

args_mandatory

Returns the list of optional arguments.

args_optional

Returns the list of optional arguments.

atts_value

Returns all parameters in a dictionary.

Static Methods#

staticmethod

truncated documentation

_norm_L1_inplace

_norm_max_inplace

norm_l1

L1 normalization

norm_l2

L2 normalization

norm_max

max normalization

Methods#

method

truncated documentation

__init__

_run

Documentation#

Runtime operator.

source on GitHub

class mlprodict.onnxrt.ops_cpu.op_normalizer.Normalizer(ai.onnx.ml)#

Bases: OpRunUnaryNum

Normalize the input. There are three normalization modes, which have the corresponding formulas, defined using element-wise infix operators ‘/’ and ‘^’ and tensor-wide functions ‘max’ and ‘sum’:

Max: Y = X / max(X)

L1: Y = X / sum(X)

L2: Y = sqrt(X^2 / sum(X^2)}

In all modes, if the divisor is zero, Y == X.

For batches, that is, [N,C] tensors, normalization is done along the C axis. In other words, each row of the batch is normalized independently.

Attributes

  • norm: One of ‘MAX,’ ‘L1,’ ‘L2’ Default value is namenormsMAXtypeSTRING (STRING)

Inputs

  • X (heterogeneous)T: Data to be encoded, a tensor of shape [N,C] or [C]

Outputs

  • Y (heterogeneous)tensor(float): Encoded output data

Type Constraints

  • T tensor(float), tensor(double), tensor(int64), tensor(int32): The input must be a tensor of a numeric type.

Version

Onnx name: Normalizer

This version of the operator has been available since version 1 of domain ai.onnx.ml.

Runtime implementation: Normalizer

__init__(onnx_node, desc=None, **options)#
static _norm_L1_inplace(x)#
static _norm_max_inplace(x)#
_run(x, attributes=None, verbose=0, fLOG=None)#

Should be overwritten.

source on GitHub

static norm_l1(x, inplace)#

L1 normalization

static norm_l2(x, inplace)#

L2 normalization

static norm_max(x, inplace)#

max normalization