mxnet
Functions
Sequence of post operations
Collaboration diagram for Sequence of post operations:

Functions

mkldnn_status_t MKLDNN_API mkldnn_post_ops_create (mkldnn_post_ops_t *post_ops)
 
mkldnn_status_t MKLDNN_API mkldnn_post_ops_destroy (mkldnn_post_ops_t post_ops)
 
int MKLDNN_API mkldnn_post_ops_len (const_mkldnn_post_ops_t post_ops)
 
mkldnn_primitive_kind_t MKLDNN_API mkldnn_post_ops_get_kind (const_mkldnn_post_ops_t post_ops, int index)
 
mkldnn_status_t MKLDNN_API mkldnn_post_ops_append_sum (mkldnn_post_ops_t post_ops, float scale)
 
mkldnn_status_t MKLDNN_API mkldnn_post_ops_get_params_sum (const_mkldnn_post_ops_t post_ops, int index, float *scale)
 
mkldnn_status_t MKLDNN_API mkldnn_post_ops_append_eltwise (mkldnn_post_ops_t post_ops, float scale, mkldnn_alg_kind_t alg, float alpha, float beta)
 
mkldnn_status_t MKLDNN_API mkldnn_post_ops_get_params_eltwise (const_mkldnn_post_ops_t post_ops, int index, float *scale, mkldnn_alg_kind_t *alg, float *alpha, float *beta)
 

Detailed Description

An extension for performing extra operations after a base operation.

Function Documentation

mkldnn_status_t MKLDNN_API mkldnn_post_ops_append_eltwise ( mkldnn_post_ops_t  post_ops,
float  scale,
mkldnn_alg_kind_t  alg,
float  alpha,
float  beta 
)

Appends eltwise post operation to the post_ops with given parameters kind, alpha, and beta (

See also
mkldnn_eltwise_forward_desc_init and mkldnn_eltwise_desc_t).

The kind of this post operation is mkldnn_eltwise.

In the simplest case when the eltwise is the only post operation, the computations would be: dst[] <- scale * eltwise_op ( op(...) ) // instead of dst[] <- op(...) where eltwise_op is configured with the given parameters.

mkldnn_status_t MKLDNN_API mkldnn_post_ops_append_sum ( mkldnn_post_ops_t  post_ops,
float  scale 
)

Appends accumulation (sum) post operation to the post_ops. Prior to accumulating the result, the previous value would be multiplied by scale.

The kind of this post operation is mkldnn_sum.

This feature might improve performance for cases like residual learning blocks, where the result of convolution is accumulated to the previously computed activations. The parameter scale might be extreme for the integer-based computations when the result and previous activations have different logical scaling factors.

In the simplest case when the accumulation is the only post operation, the computations would be: dst[] <- scale * dst[] + op(...) // instead of dst[] <- op(...)

Note
This post operation (as well as all the others) disregards the original layout of the destination; that is, the layout of the original destination is expected to be the same as the layout of the stored destination.
mkldnn_status_t MKLDNN_API mkldnn_post_ops_create ( mkldnn_post_ops_t post_ops)

Creates an empty sequence of post operations post_ops.

mkldnn_status_t MKLDNN_API mkldnn_post_ops_destroy ( mkldnn_post_ops_t  post_ops)

Deletes a post_ops sequence.

mkldnn_primitive_kind_t MKLDNN_API mkldnn_post_ops_get_kind ( const_mkldnn_post_ops_t  post_ops,
int  index 
)

Returns the type of post operation with index index in given post_ops. In case of error, returns mkldnn_undefined_primitive.

mkldnn_status_t MKLDNN_API mkldnn_post_ops_get_params_eltwise ( const_mkldnn_post_ops_t  post_ops,
int  index,
float *  scale,
mkldnn_alg_kind_t alg,
float *  alpha,
float *  beta 
)

Gets the eltwise parameters of the post operation with index index in the sequence of post_ops.

mkldnn_status_t MKLDNN_API mkldnn_post_ops_get_params_sum ( const_mkldnn_post_ops_t  post_ops,
int  index,
float *  scale 
)

Gets the parameters of the accumulation (sum) post operation with index index in the sequence of post_ops.

Note
If index index would not correspond to the accumulation post operation, the function returns mkldnn_invalid_arguments.
int MKLDNN_API mkldnn_post_ops_len ( const_mkldnn_post_ops_t  post_ops)

Returns the length of post operations for given post_ops.