Deep Neural Network Library (DNNL)  1.1.3
Performance library for Deep Learning
Functions
Sequence of post operations

An extension for performing extra operations after a base operation. More...

Functions

dnnl_status_t DNNL_API dnnl_post_ops_create (dnnl_post_ops_t *post_ops)
 Creates an empty sequence of post operations post_ops.
 
dnnl_status_t DNNL_API dnnl_post_ops_destroy (dnnl_post_ops_t post_ops)
 Deletes a post_ops sequence.
 
int DNNL_API dnnl_post_ops_len (const_dnnl_post_ops_t post_ops)
 Returns the length of post operations for given post_ops.
 
dnnl_primitive_kind_t DNNL_API dnnl_post_ops_get_kind (const_dnnl_post_ops_t post_ops, int index)
 Returns the kind of post operation with index index in given post_ops. More...
 
dnnl_status_t DNNL_API dnnl_post_ops_append_sum (dnnl_post_ops_t post_ops, float scale)
 Appends accumulation (sum) post operation to the post_ops. More...
 
dnnl_status_t DNNL_API dnnl_post_ops_get_params_sum (const_dnnl_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. More...
 
dnnl_status_t DNNL_API dnnl_post_ops_append_eltwise (dnnl_post_ops_t post_ops, float scale, dnnl_alg_kind_t alg, float alpha, float beta)
 Appends eltwise post operation to the post_ops with given parameters kind, alpha, and beta (. More...
 
dnnl_status_t DNNL_API dnnl_post_ops_get_params_eltwise (const_dnnl_post_ops_t post_ops, int index, float *scale, dnnl_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. More...
 

Detailed Description

An extension for performing extra operations after a base operation.

Function Documentation

◆ dnnl_post_ops_get_kind()

dnnl_primitive_kind_t DNNL_API dnnl_post_ops_get_kind ( const_dnnl_post_ops_t  post_ops,
int  index 
)

Returns the kind of post operation with index index in given post_ops.

In case of error, returns dnnl_undefined_primitive.

◆ dnnl_post_ops_append_sum()

dnnl_status_t DNNL_API dnnl_post_ops_append_sum ( dnnl_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 dnnl_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.

◆ dnnl_post_ops_get_params_sum()

dnnl_status_t DNNL_API dnnl_post_ops_get_params_sum ( const_dnnl_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 dnnl_invalid_arguments.

◆ dnnl_post_ops_append_eltwise()

dnnl_status_t DNNL_API dnnl_post_ops_append_eltwise ( dnnl_post_ops_t  post_ops,
float  scale,
dnnl_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
dnnl_eltwise_forward_desc_init and dnnl_eltwise_desc_t).

The kind of this post operation is dnnl_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.

◆ dnnl_post_ops_get_params_eltwise()

dnnl_status_t DNNL_API dnnl_post_ops_get_params_eltwise ( const_dnnl_post_ops_t  post_ops,
int  index,
float *  scale,
dnnl_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.