struct dnnl::primitive_desc_base

Overview

Base class for all primitive descriptors. More…

#include <dnnl.hpp>

struct primitive_desc_base: public dnnl::handle
{
    // methods

    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;
};

// direct descendants

struct primitive_desc;
struct primitive_desc;
struct primitive_desc;
struct primitive_desc;

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;

Detailed Documentation

Base class for all primitive descriptors.

Methods

engine get_engine() const

Returns the engine of the primitive descriptor.

Returns:

The engine of the primitive descriptor.

const char* impl_info_str() const

Returns implementation name.

Returns:

The implementation name.

memory::dim query_s64(query what) const

Returns a memory::dim value (same as int64_t).

Parameters:

what

The value to query.

Returns:

The result of the query.

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.

float get_epsilon() const

Returns an epsilon.

Returns:

An epsilon.

Zero if the primitive does not have an epsilon parameter.

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

Returns flags.

Parameters:

T

Flags enumeration type.

Returns:

Flags.

Zero if the primitive does not have a flags parameter.

dnnl::algorithm get_algorithm() const

Returns an algorithm kind.

Returns:

An algorithm kind.

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

float get_alpha() const

Returns an alpha.

Returns:

An alpha.

Zero if the primitive does not have an alpha parameter.

float get_beta() const

Returns a beta.

Returns:

A beta.

Zero if the primitive does not have a beta parameter.

int get_axis() const

Returns an axis.

Returns:

An axis.

A negative number if the primitive does not have an axis parameter.

memory::dim get_local_size() const

Returns an LRN local size parameter.

Returns:

An LRN local size parameter.

Zero if the primitive does not have an LRN local size parameter.

float get_k() const

Returns an LRN K parameter.

Returns:

An LRN K parameter.

Zero if the primitive does not have an LRN K parameter.

float get_p() const

Returns a reduction P parameter.

Returns:

A reduction P parameter.

Zero if the primitive does not have a reduction P parameter.

std::vector<float> get_factors() const

Returns a resampling factors parameters.

Returns:

A vector of factors.

An empty vector if the primitive does not have a resampling factors parameter.

dnnl::algorithm get_cell_kind() const

Returns an RNN cell kind parameter.

Returns:

An RNN cell kind parameter.

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

dnnl::rnn_direction get_direction() const

Returns an RNN direction parameter.

Returns:

An RNN direction parameter.

dnnl::rnn_direction::undef if the primitive does not have an RNN direction parameter.

dnnl::algorithm get_activation_kind() const

Returns an RNN activation kind parameter.

Returns:

An RNN activation kind parameter.

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

memory::dims get_kernel() const

Returns a pooling kernel parameter.

Returns:

A pooling kernel parameter.

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

memory::dim get_group_size() const

Returns a group size parameter.

Returns:

A group size parameter.

Zero if the primitive does not have a group size parameter.

dnnl::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::desc query_md(query what, int idx = 0) const

Returns a memory descriptor.

Note

There are also convenience methods dnnl::primitive_desc_base::src_desc(), dnnl::primitive_desc_base::dst_desc(), and others.

Parameters:

what

The kind of parameter to query; can be dnnl::query::src_md, dnnl::query::dst_md, etc.

idx

Index of the parameter. For example, convolution bias can be queried with what = dnnl::query::weights_md and idx = 1.

Returns:

The requested memory descriptor.

A zero memory descriptor if the primitive does not have a parameter of the specified kind or index.

memory::desc src_desc(int idx) const

Returns a source memory descriptor.

Parameters:

idx

Source index.

Returns:

Source memory descriptor.

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

memory::desc dst_desc(int idx) const

Returns a destination memory descriptor.

Parameters:

idx

Destination index.

Returns:

Destination memory descriptor.

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

memory::desc weights_desc(int idx) const

Returns a weights memory descriptor.

Parameters:

idx

Weights index.

Returns:

Weights memory descriptor.

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

memory::desc diff_src_desc(int idx) const

Returns a diff source memory descriptor.

Parameters:

idx

Diff source index.

Returns:

Diff source memory descriptor.

A zero memory descriptor if the primitive does not have a diff source parameter with index idx.

memory::desc diff_dst_desc(int idx) const

Returns a diff destination memory descriptor.

Parameters:

idx

Diff destination index.

Returns:

Diff destination memory descriptor.

A zero memory descriptor if the primitive does not have a diff destination parameter with index idx.

memory::desc diff_weights_desc(int idx) const

Returns a diff weights memory descriptor.

Parameters:

idx

Diff weights index.

Returns:

Diff weights memory descriptor.

A zero memory descriptor if the primitive does not have a diff weights parameter with index idx.

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 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 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 diff_src_desc() const

Returns a diff source memory descriptor.

Returns:

Diff source memory descriptor.

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

memory::desc diff_dst_desc() const

Returns a diff destination memory descriptor.

Returns:

Diff destination memory descriptor.

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

memory::desc diff_weights_desc() const

Returns a diff weights memory descriptor.

Returns:

Diff weights memory descriptor.

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

memory::desc workspace_desc() const

Returns the workspace memory descriptor.

Returns:

Workspace memory descriptor.

A zero memory descriptor if the primitive does not require workspace parameter.

memory::desc scratchpad_desc() const

Returns the scratchpad memory descriptor.

Returns:

scratchpad memory descriptor.

A zero memory descriptor if the primitive does not require scratchpad parameter.

See also:

Primitive Attributes: Scratchpad

engine scratchpad_engine() const

Returns the engine on which the scratchpad memory is located.

Returns:

The engine on which the scratchpad memory is located.

primitive_attr get_primitive_attr() const

Returns the primitive attributes.

Returns:

The primitive attributes.

dnnl::primitive::kind get_kind() const

Returns the kind of the primitive descriptor.

Returns:

The kind of the primitive descriptor.

std::vector<uint8_t> get_cache_blob_id() const

Returns the cache blob ID of the primitive descriptor.

Returns:

The cache blob ID of the primitive descriptor.