struct dnnl::convolution_forward::primitive_desc

Overview

Primitive descriptor for a convolution forward propagation primitive. More…

#include <dnnl.hpp>

struct primitive_desc: public dnnl::primitive_desc
{
    // construction

    primitive_desc();

    primitive_desc(
        const engine& aengine,
        prop_kind aprop_kind,
        algorithm aalgorithm,
        const memory::desc& src_desc,
        const memory::desc& weights_desc,
        const memory::desc& bias_desc,
        const memory::desc& dst_desc,
        const memory::dims& strides,
        const memory::dims& padding_l,
        const memory::dims& padding_r,
        const primitive_attr& attr = default_attr(),
        bool allow_empty = false
        );

    primitive_desc(
        const engine& aengine,
        prop_kind aprop_kind,
        algorithm aalgorithm,
        const memory::desc& src_desc,
        const memory::desc& weights_desc,
        const memory::desc& dst_desc,
        const memory::dims& strides,
        const memory::dims& padding_l,
        const memory::dims& padding_r,
        const primitive_attr& attr = default_attr(),
        bool allow_empty = false
        );

    primitive_desc(
        const engine& aengine,
        prop_kind aprop_kind,
        algorithm aalgorithm,
        const memory::desc& src_desc,
        const memory::desc& weights_desc,
        const memory::desc& bias_desc,
        const memory::desc& dst_desc,
        const memory::dims& strides,
        const memory::dims& dilates,
        const memory::dims& padding_l,
        const memory::dims& padding_r,
        const primitive_attr& attr = default_attr(),
        bool allow_empty = false
        );

    primitive_desc(
        const engine& aengine,
        prop_kind aprop_kind,
        algorithm aalgorithm,
        const memory::desc& src_desc,
        const memory::desc& weights_desc,
        const memory::desc& dst_desc,
        const memory::dims& strides,
        const memory::dims& dilates,
        const memory::dims& padding_l,
        const memory::dims& padding_r,
        const primitive_attr& attr = default_attr(),
        bool allow_empty = false
        );

    primitive_desc(dnnl_primitive_desc_t pd);

    // methods

    memory::desc src_desc() const;
    memory::desc weights_desc() const;
    memory::desc dst_desc() const;
    memory::desc bias_desc() const;
    algorithm get_algorithm() const;
    prop_kind get_prop_kind() const;
    memory::dims get_strides() const;
    memory::dims get_dilations() const;
    memory::dims get_padding_l() const;
    memory::dims get_padding_r() const;
};

Inherited Members

public:
    // methods

    handle<T, traits>& operator = (const handle<T, traits>&);
    handle<T, traits>& operator = (handle<T, traits>&&);
    void reset(T t, bool weak = false);
    T get(bool allow_empty = false) const;
    operator T () const;
    operator bool () const;
    bool operator == (const handle<T, traits>& other) const;
    bool operator != (const handle& other) const;
    engine get_engine() const;
    const char* impl_info_str() const;
    memory::dim query_s64(query what) const;
    memory::dims get_strides() const;
    memory::dims get_dilations() const;
    memory::dims get_padding_l() const;
    memory::dims get_padding_r() const;
    float get_epsilon() const;

    template <typename T = unsigned>
    T get_flags() const;

    dnnl::algorithm get_algorithm() const;
    float get_alpha() const;
    float get_beta() const;
    int get_axis() const;
    memory::dim get_local_size() const;
    float get_k() const;
    float get_p() const;
    std::vector<float> get_factors() const;
    dnnl::algorithm get_cell_kind() const;
    dnnl::rnn_direction get_direction() const;
    dnnl::algorithm get_activation_kind() const;
    memory::dims get_kernel() const;
    memory::dim get_group_size() const;
    dnnl::prop_kind get_prop_kind() const;
    memory::desc query_md(query what, int idx = 0) const;
    memory::desc src_desc(int idx) const;
    memory::desc dst_desc(int idx) const;
    memory::desc weights_desc(int idx) const;
    memory::desc diff_src_desc(int idx) const;
    memory::desc diff_dst_desc(int idx) const;
    memory::desc diff_weights_desc(int idx) const;
    memory::desc src_desc() const;
    memory::desc dst_desc() const;
    memory::desc weights_desc() const;
    memory::desc diff_src_desc() const;
    memory::desc diff_dst_desc() const;
    memory::desc diff_weights_desc() const;
    memory::desc workspace_desc() const;
    memory::desc scratchpad_desc() const;
    engine scratchpad_engine() const;
    primitive_attr get_primitive_attr() const;
    dnnl::primitive::kind get_kind() const;
    std::vector<uint8_t> get_cache_blob_id() const;
    bool next_impl();
    primitive_desc_base();
    primitive_desc_base();
    primitive_desc_base();
    primitive_desc_base();

Detailed Documentation

Primitive descriptor for a convolution forward propagation primitive.

Construction

primitive_desc()

Default constructor. Produces an empty object.

primitive_desc(
    const engine& aengine,
    prop_kind aprop_kind,
    algorithm aalgorithm,
    const memory::desc& src_desc,
    const memory::desc& weights_desc,
    const memory::desc& bias_desc,
    const memory::desc& dst_desc,
    const memory::dims& strides,
    const memory::dims& padding_l,
    const memory::dims& padding_r,
    const primitive_attr& attr = default_attr(),
    bool allow_empty = false
    )

Constructs a primitive descriptor for a convolution forward propagation primitive with bias.

Note

All the memory descriptors may be initialized with the dnnl::memory::format_tag::any value of format_tag.

Arrays strides, padding_l, and padding_r contain values for spatial dimensions only and hence must have the same number of elements as there are spatial dimensions. The order of values is the same as in the tensor: depth (for 3D tensors), height (for 3D and 2D tensors), and width.

Parameters:

aengine

Engine to use.

aprop_kind

Propagation kind. Possible values are dnnl::prop_kind::forward_training, and dnnl::prop_kind::forward_inference.

aalgorithm

Convolution algorithm. Possible values are dnnl::algorithm::convolution_direct, dnnl::algorithm::convolution_winograd, and dnnl::algorithm::convolution_auto.

src_desc

Source memory descriptor.

weights_desc

Weights memory descriptor.

bias_desc

Bias memory descriptor. Passing zero memory descriptor disables the bias term.

dst_desc

Destination memory descriptor.

strides

Strides for each spatial dimension.

padding_l

Vector of padding values for low indices for each spatial dimension ([[front,] top,] left).

padding_r

Vector of padding values for high indices for each spatial dimension ([[back,] bottom,] right).

attr

Primitive attributes to use. Attributes are optional and default to empty attributes.

allow_empty

A flag signifying whether construction is allowed to fail without throwing an exception. In this case an empty object will be produced. This flag is optional and defaults to false.

primitive_desc(
    const engine& aengine,
    prop_kind aprop_kind,
    algorithm aalgorithm,
    const memory::desc& src_desc,
    const memory::desc& weights_desc,
    const memory::desc& dst_desc,
    const memory::dims& strides,
    const memory::dims& padding_l,
    const memory::dims& padding_r,
    const primitive_attr& attr = default_attr(),
    bool allow_empty = false
    )

Constructs a primitive descriptor for a convolution forward propagation primitive without bias.

Note

All the memory descriptors may be initialized with the dnnl::memory::format_tag::any value of format_tag.

Arrays strides, padding_l, and padding_r contain values for spatial dimensions only and hence must have the same number of elements as there are spatial dimensions. The order of values is the same as in the tensor: depth (for 3D tensors), height (for 3D and 2D tensors), and width.

Parameters:

aengine

Engine to use.

aprop_kind

Propagation kind. Possible values are dnnl::prop_kind::forward_training, and dnnl::prop_kind::forward_inference.

aalgorithm

Convolution algorithm. Possible values are dnnl::algorithm::convolution_direct, dnnl::algorithm::convolution_winograd, and dnnl::algorithm::convolution_auto.

src_desc

Source memory descriptor.

weights_desc

Weights memory descriptor.

dst_desc

Destination memory descriptor.

strides

Strides for each spatial dimension.

padding_l

Vector of padding values for low indices for each spatial dimension ([[front,] top,] left).

padding_r

Vector of padding values for high indices for each spatial dimension ([[back,] bottom,] right).

attr

Primitive attributes to use. Attributes are optional and default to empty attributes.

allow_empty

A flag signifying whether construction is allowed to fail without throwing an exception. In this case an empty object will be produced. This flag is optional and defaults to false.

primitive_desc(
    const engine& aengine,
    prop_kind aprop_kind,
    algorithm aalgorithm,
    const memory::desc& src_desc,
    const memory::desc& weights_desc,
    const memory::desc& bias_desc,
    const memory::desc& dst_desc,
    const memory::dims& strides,
    const memory::dims& dilates,
    const memory::dims& padding_l,
    const memory::dims& padding_r,
    const primitive_attr& attr = default_attr(),
    bool allow_empty = false
    )

Constructs a primitive descriptor for a convolution forward propagation primitive with bias.

Note

All the memory descriptors may be initialized with the dnnl::memory::format_tag::any value of format_tag.

Arrays strides, dilates, padding_l, and padding_r contain values for spatial dimensions only and hence must have the same number of elements as there are spatial dimensions. The order of values is the same as in the tensor: depth (for 3D tensors), height (for 3D and 2D tensors), and width.

Parameters:

aengine

Engine to use.

aprop_kind

Propagation kind. Possible values are dnnl::prop_kind::forward_training, and dnnl::prop_kind::forward_inference.

aalgorithm

Convolution algorithm. Possible values are dnnl::algorithm::convolution_direct, dnnl::algorithm::convolution_winograd, and dnnl::algorithm::convolution_auto.

src_desc

Source memory descriptor.

weights_desc

Weights memory descriptor.

bias_desc

Bias memory descriptor. Passing zero memory descriptor disables the bias term.

dst_desc

Destination memory descriptor.

strides

Strides for each spatial dimension.

dilates

Dilations for each spatial dimension. A zero value means no dilation in the corresponding dimension.

padding_l

Vector of padding values for low indices for each spatial dimension ([[front,] top,] left).

padding_r

Vector of padding values for high indices for each spatial dimension ([[back,] bottom,] right).

attr

Primitive attributes to use. Attributes are optional and default to empty attributes.

allow_empty

A flag signifying whether construction is allowed to fail without throwing an exception. In this case an empty object will be produced. This flag is optional and defaults to false.

primitive_desc(
    const engine& aengine,
    prop_kind aprop_kind,
    algorithm aalgorithm,
    const memory::desc& src_desc,
    const memory::desc& weights_desc,
    const memory::desc& dst_desc,
    const memory::dims& strides,
    const memory::dims& dilates,
    const memory::dims& padding_l,
    const memory::dims& padding_r,
    const primitive_attr& attr = default_attr(),
    bool allow_empty = false
    )

Constructs a primitive descriptor for a convolution forward propagation primitive without bias.

Note

All the memory descriptors may be initialized with the dnnl::memory::format_tag::any value of format_tag.

Arrays strides, dilates, padding_l, and padding_r contain values for spatial dimensions only and hence must have the same number of elements as there are spatial dimensions. The order of values is the same as in the tensor: depth (for 3D tensors), height (for 3D and 2D tensors), and width.

Parameters:

aengine

Engine to use.

aprop_kind

Propagation kind. Possible values are dnnl::prop_kind::forward_training, and dnnl::prop_kind::forward_inference.

aalgorithm

Convolution algorithm. Possible values are dnnl::algorithm::convolution_direct, dnnl::algorithm::convolution_winograd, and dnnl::algorithm::convolution_auto.

src_desc

Source memory descriptor.

weights_desc

Weights memory descriptor.

dst_desc

Destination memory descriptor.

strides

Strides for each spatial dimension.

dilates

Dilations for each spatial dimension. A zero value means no dilation in the corresponding dimension.

padding_l

Vector of padding values for low indices for each spatial dimension ([[front,] top,] left).

padding_r

Vector of padding values for high indices for each spatial dimension ([[back,] bottom,] right).

attr

Primitive attributes to use. Attributes are optional and default to empty attributes.

allow_empty

A flag signifying whether construction is allowed to fail without throwing an exception. In this case an empty object will be produced. This flag is optional and defaults to false.

primitive_desc(dnnl_primitive_desc_t pd)

Constructs a primitive descriptor for a convolution forward propagation primitive from a C API primitive descriptor that must have a matching kind.

Parameters:

pd

C API primitive descriptor for a convolution forward propagation primitive.

Methods

memory::desc src_desc() const

Returns a source memory descriptor.

Returns:

Source memory descriptor.

A zero memory descriptor if the primitive does not have a source parameter.

memory::desc weights_desc() const

Returns a weights memory descriptor.

Returns:

Weights memory descriptor.

A zero memory descriptor if the primitive does not have a weights parameter.

memory::desc dst_desc() const

Returns a destination memory descriptor.

Returns:

Destination memory descriptor.

A zero memory descriptor if the primitive does not have a destination parameter.

memory::desc bias_desc() const

Returns the bias memory descriptor.

Returns:

The bias memory descriptor.

A zero memory descriptor of the primitive does not have a bias parameter.

algorithm get_algorithm() const

Returns an algorithm kind.

Returns:

An algorithm kind.

dnnl::algorithm::undef if the primitive does not have an algorithm parameter.

prop_kind get_prop_kind() const

Returns a propagation kind.

Returns:

A propagation kind.

dnnl::prop_kind::undef if the primitive does not have a propagation parameter.

memory::dims get_strides() const

Returns strides.

Returns:

Strides.

An empty dnnl::memory::dims if the primitive does not have a strides parameter.

memory::dims get_dilations() const

Returns dilations.

Returns:

Dilations.

An empty dnnl::memory::dims if the primitive does not have a dilations parameter.

memory::dims get_padding_l() const

Returns a left padding.

Returns:

A left padding.

An empty dnnl::memory::dims if the primitive does not have a left padding parameter.

memory::dims get_padding_r() const

Returns a right padding.

Returns:

A right padding.

An empty dnnl::memory::dims if the primitive does not have a right padding parameter.