* Initial version of ReduceL1, ReduceL2 and ReduceLp enabling in the MO * Added operations ReduceL1 and ReduceL2 to nGraph * Removed ReduceLp. Added ReduceL1 and ReduceL2 * Separated specification of ReduceLp into ReduceL1 and ReduceL2 * Updated ReduceL1 and ReduceL2 specification * Fixed ReduceL1 and ReduceL2 type prop tests * Implemented nGraph transformation to decompose ReduceL1 and ReduceL2. Disabled them for CPU and GPU plugins * Updated supported framework layers * Added unit tests for ReduceL1 and ReduceL2 reference implementation * Fixed ReduceXXX operations reference implementation by adding support for a new parameter 'keep_dims' * Fixed constant folding for v0::Any * Added ReduceL1 and ReduceL2 to Python API * Implemented ReduceL1 and ReduceL2 decomposition tests and fixed ReduceL2 decomposition * Added specific creator for ReduceXXX operations instead of NodeBuilders * Fixed conversion ReduceXXX to CNNLayer * Fixed parser for ReduceLogicalXXX operations
4.2 KiB
ReduceLp
Versioned name: ReduceL2-4
Category: Reduction
Short description: ReduceL2 operation performs reduction with finding the L2 norm (square root of sum of squares) of the 1st input tensor in slices specified by the 2nd input.
Attributes
-
keep_dims
- Description: If set to
Trueit holds axes that are used for reduction. For each such axis, output dimension is equal to 1. - Range of values: True or False
- Type:
boolean - Default value: False
- Required: no
- Description: If set to
Inputs
-
1: Input tensor x of type T1. Required.
-
2: Scalar or 1D tensor of type T_IND with axis indices for the 1st input along which reduction is performed. Accepted range is
[-r, r - 1]where whereris the rank of input tensor, all values must be unique, repeats are not allowed. Required.
Outputs
- 1: Tensor of the same type as the 1st input tensor and
shape[i] = shapeOf(input1)[i]for allithat is not in the list of axes from the 2nd input. For dimensions from the 2nd input tensor,shape[i] == 1ifkeep_dims == True, ori-th dimension is removed from the output otherwise.
Types
- T1: floating point type.
- T2:
int64orint32.
Detailed Description
Each element in the output is the result of reduction with finding a Lp norm operation along dimensions specified by the 2nd input:
output[i0, i1, ..., iN] = L2[j0,..., jN](x[j0, ..., jN]))
Where indices i0, ..., iN run through all valid indices for the 1st input and finding the Lp norm L2[j0, ..., jN] have jk = ik for those dimensions k that are not in the set of indices specified by the 2nd input of the operation.
Corner cases:
- When the 2nd input is an empty list, then this operation does nothing, it is an identity.
- When the 2nd input contains all dimensions of the 1st input, this means that a single reduction scalar value is calculated for entire input tensor.
Example
<layer id="1" type="ReduceL2" ...>
<data keep_dims="True" />
<input>
<port id="0">
<dim>6</dim>
<dim>12</dim>
<dim>10</dim>
<dim>24</dim>
</port>
<port id="1">
<dim>2</dim> <!-- value is [2, 3] that means independent reduction in each channel and batch -->
</port>
</input>
<output>
<port id="2">
<dim>6</dim>
<dim>12</dim>
<dim>1</dim>
<dim>1</dim>
</port>
</output>
</layer>
<layer id="1" type="ReduceL2" ...>
<data keep_dims="False" />
<input>
<port id="0">
<dim>6</dim>
<dim>12</dim>
<dim>10</dim>
<dim>24</dim>
</port>
<port id="1">
<dim>2</dim> <!-- value is [2, 3] that means independent reduction in each channel and batch -->
</port>
</input>
<output>
<port id="2">
<dim>6</dim>
<dim>12</dim>
</port>
</output>
</layer>
<layer id="1" type="ReduceL2" ...>
<data keep_dims="False" />
<input>
<port id="0">
<dim>6</dim>
<dim>12</dim>
<dim>10</dim>
<dim>24</dim>
</port>
<port id="1">
<dim>1</dim> <!-- value is [1] that means independent reduction in each channel and spatial dimensions -->
</port>
</input>
<output>
<port id="2">
<dim>6</dim>
<dim>10</dim>
<dim>24</dim>
</port>
</output>
</layer>
<layer id="1" type="ReduceL2" ...>
<data keep_dims="False" />
<input>
<port id="0">
<dim>6</dim>
<dim>12</dim>
<dim>10</dim>
<dim>24</dim>
</port>
<port id="1">
<dim>1</dim> <!-- value is [-2] that means independent reduction in each channel, batch and second spatial dimension -->
</port>
</input>
<output>
<port id="2">
<dim>6</dim>
<dim>12</dim>
<dim>24</dim>
</port>
</output>
</layer>