clDNN
|
Normalizes the input using an L2 norm and multiplies the output with scale value. The scale can be equal for all channels or one scale per channel. More...
#include <normalize.hpp>
Public Types | |
typedef cldnn_normalize_desc | dto |
Public Member Functions | |
normalize (const primitive_id &id, const primitive_id &input, const primitive_id &scale_input, const bool across_spatial=true, const float epsilon=1e-10f, const padding &output_padding=padding()) | |
Constructs normalize primitive. More... | |
normalize (const dto *dto) | |
Constructs a copy from C API cldnn_normalize_desc. | |
![]() | |
const cldnn_primitive_desc * | get_dto () const override |
Returns pointer to a C API primitive descriptor casted to cldnn_primitive_desc. | |
![]() | |
primitive (const primitive_type_id &type, const primitive_id &id, const std::vector< primitive_id > &input, const padding &output_padding=padding()) | |
primitive (const cldnn_primitive_desc *dto) | |
Constructs a copy from basic C API cldnn_primitive_desc. | |
std::vector< std::reference_wrapper< primitive_id > > | dependecies () |
Returns references to all primitive ids on which this primitive depends - inputs, weights, biases, etc. | |
std::vector< primitive_id > | dependecies () const |
Returns copy of all primitive ids on which this primitive depends - inputs, weights, biases, etc. | |
operator primitive_id () const | |
Implicit conversion to primiitive id. | |
Static Public Member Functions | |
static primitive_type_id | type_id () |
Public Attributes | |
primitive_id | scale_input |
Scale input primitive id with values needed for scaling after the normalization. Scale x dimension should be 1 (if all channels have the same scale) or equal to input feature size (one scale per channel). All other dimensions should be 1. | |
bool | across_spatial |
Determines if the normalization is done across or within spatial (see documentation above). | |
float | epsilon |
Epsilon for not dividing by zero while normalizing. | |
![]() | |
const primitive_type_id | type |
Primitive's type id. | |
const primitive_id | id |
Primitive's id. | |
fixed_size_vector_ref | input |
List of ids of input primitives. | |
padding | output_padding |
Requested output padding. | |
Protected Member Functions | |
std::vector< std::reference_wrapper< const primitive_id > > | get_dependencies () const override |
void | update_dto (dto &dto) const override |
![]() | |
primitive_base (const primitive_id &id, const std::vector< primitive_id > &input, const padding &output_padding=padding()) | |
primitive_base (const cldnn_normalize_desc *dto) | |
Additional Inherited Members | |
![]() | |
primitive_id_arr | _input |
Normalizes the input using an L2 norm and multiplies the output with scale value. The scale can be equal for all channels or one scale per channel.
The L2 norm is computed as:
Across spatial mode (across_spatial=true)-
norm(i,x,y) = sqrt( Σ( in(f,w,h)^2 ) + epsilon ) where f in range (0,num_of_features), w in range (0,input_width), h in range (0,input_height).
The summation is performed over all the pixels in the batch.
Within spatial mode (across_spatial=false)-
norm(i,x,y) = sqrt( Σ( in(f,x,y)^2 ) + epsilon ) where f in range (0,num_of_features).
The summation is performed over this (x,y) position on all the features.
Definition at line 47 of file normalize.hpp.
|
inline |
Constructs normalize primitive.
id | This primitive id. |
input | Input primitive id. |
scale_input | Scale input primitive id with values needed for scaling after the normalization. Scale x dimension should be 1 (if all channels have the same scale) or equal to input feature size (one scale per channel). All other dimensions should be 1. |
across_spatial | Determines if the normalization is done across or within spatial (see documentation above). |
epsilon | Epsilon for not dividing by zero while normalizing. |
Definition at line 59 of file normalize.hpp.