module onnxrt.ops_cpu.op_normalizer
#
Short summary#
module mlprodict.onnxrt.ops_cpu.op_normalizer
Runtime operator.
Classes#
class |
truncated documentation |
---|---|
Normalizer (ai.onnx.ml) ======================= Normalize the input. There are three normalization modes, which have … |
Properties#
property |
truncated documentation |
---|---|
|
Returns the list of arguments as well as the list of parameters with the default values (close to the signature). … |
|
Returns the list of modified parameters. |
|
Returns the list of optional arguments. |
|
Returns the list of optional arguments. |
|
Returns all parameters in a dictionary. |
Static Methods#
staticmethod |
truncated documentation |
---|---|
L1 normalization |
|
L2 normalization |
|
max normalization |
Methods#
method |
truncated documentation |
---|---|
Documentation#
Runtime operator.
- 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.
- static norm_l1(x, inplace)#
L1 normalization
- static norm_l2(x, inplace)#
L2 normalization
- static norm_max(x, inplace)#
max normalization