Reduction

Overview

A primitive to compute reduction operation on data tensor using min, max, mul, sum, mean and norm_lp operations. More…

// structs

struct dnnl::reduction;

// global functions

dnnl_status_t DNNL_API dnnl_reduction_primitive_desc_create(
    dnnl_primitive_desc_t* primitive_desc,
    dnnl_engine_t engine,
    dnnl_alg_kind_t alg_kind,
    const_dnnl_memory_desc_t src_desc,
    const_dnnl_memory_desc_t dst_desc,
    float p,
    float eps,
    const_dnnl_primitive_attr_t attr
    );

Detailed Documentation

A primitive to compute reduction operation on data tensor using min, max, mul, sum, mean and norm_lp operations.

See also:

Reduction in developer guide

Global Functions

dnnl_status_t DNNL_API dnnl_reduction_primitive_desc_create(
    dnnl_primitive_desc_t* primitive_desc,
    dnnl_engine_t engine,
    dnnl_alg_kind_t alg_kind,
    const_dnnl_memory_desc_t src_desc,
    const_dnnl_memory_desc_t dst_desc,
    float p,
    float eps,
    const_dnnl_primitive_attr_t attr
    )

Creates a primitive descriptor for a reduction primitive.

Note

Destination memory descriptor is allowed to be initialized with dnnl_format_tag_any or with format_kind set to dnnl_format_kind_any.

Parameters:

primitive_desc

Output primitive descriptor.

engine

Engine to use.

alg_kind

reduction algorithm kind. Possible values: dnnl_reduction_max, dnnl_reduction_min, dnnl_reduction_sum, dnnl_reduction_mul, dnnl_reduction_mean, dnnl_reduction_norm_lp_max, dnnl_reduction_norm_lp_sum, dnnl_reduction_norm_lp_power_p_max, dnnl_reduction_norm_lp_power_p_sum.

p

Algorithm specific parameter.

eps

Algorithm specific parameter.

src_desc

Source memory descriptor.

dst_desc

Destination memory descriptor.

attr

Primitive attributes (can be NULL).

Returns:

dnnl_success on success and a status describing the error otherwise.