clDNN
cldnn::softmax Struct Reference

Normalizes results so they sum to 1. More...

#include <softmax.hpp>

Inheritance diagram for cldnn::softmax:
Collaboration diagram for cldnn::softmax:

Public Types

enum  dimension_t { normalize_f = cldnn_softmax_normalize_f, normalize_x = cldnn_softmax_normalize_x, normalize_y = cldnn_softmax_normalize_y, normalize_fyx = cldnn_softmax_normalize_fyx }
 Enum type to specify softmax's normalization scope (see dimension).
 
typedef cldnn_softmax_desc dto
 

Public Member Functions

 softmax (const primitive_id &id, const primitive_id &input, const dimension_t dimension=normalize_fyx, const padding &output_padding=padding())
 Constructs softmax primitive. More...
 
 softmax (const dto *dto)
 Constructs a copy from C API cldnn_softmax_desc.
 
- Public Member Functions inherited from cldnn::primitive_base< softmax, cldnn_softmax_desc >
const cldnn_primitive_descget_dto () const override
 Returns pointer to a C API primitive descriptor casted to cldnn_primitive_desc.
 
- Public Member Functions inherited from cldnn::primitive
 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_iddependecies () 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

dimension_t dimension
 Defines a scope of a single softmax normalization. More...
 
- Public Attributes inherited from cldnn::primitive
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.
 

Additional Inherited Members

- Protected Member Functions inherited from cldnn::primitive_base< softmax, cldnn_softmax_desc >
 primitive_base (const primitive_id &id, const std::vector< primitive_id > &input, const padding &output_padding=padding())
 
 primitive_base (const cldnn_softmax_desc *dto)
 
- Protected Member Functions inherited from cldnn::primitive
virtual std::vector< std::reference_wrapper< const primitive_id > > get_dependencies () const
 
- Protected Attributes inherited from cldnn::primitive
primitive_id_arr _input
 

Detailed Description

Normalizes results so they sum to 1.

Algorithm:
b = e^a/sum(N-1; j=0; e^j)
Where:
  • N : number of values to normalize
  • b : value after normalization
  • a : value before normalization

Definition at line 39 of file softmax.hpp.

Constructor & Destructor Documentation

◆ softmax()

cldnn::softmax::softmax ( const primitive_id id,
const primitive_id input,
const dimension_t  dimension = normalize_fyx,
const padding output_padding = padding() 
)
inline

Constructs softmax primitive.

Parameters
idThis primitive id.
inputInput primitive id.
dimensionDefines a scope of normalization (see dimension).

Definition at line 56 of file softmax.hpp.

Member Data Documentation

◆ dimension

dimension_t cldnn::softmax::dimension

Defines a scope of a single softmax normalization.

Being given a 4-dimensional input, which consists of b,f,y,x dimensions, softmax normalizes data which are divided into multiple independent sets. Specific behaviour is determined by this parameter, as follows:

Definition at line 80 of file softmax.hpp.


The documentation for this struct was generated from the following file: