struct dnnl::primitive_desc

Overview

A base class for descriptors of all primitives that have an operation descriptor and that support iteration over multiple implementations. More…

#include <dnnl.hpp>

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

    primitive_desc();

    primitive_desc(
        const_dnnl_op_desc_t desc,
        const primitive_attr* attr,
        const engine& aengine,
        const_dnnl_primitive_desc_t hint_fwd_pd,
        bool allow_empty = false
        );

    bool next_impl();
};

// direct descendants

struct primitive_desc;
struct primitive_desc;
struct primitive_desc;
struct primitive_desc;
struct primitive_desc;
struct primitive_desc;
struct primitive_desc;
struct primitive_desc;
struct primitive_desc;
struct primitive_desc;
struct primitive_desc;
struct primitive_desc;
struct primitive_desc;
struct primitive_desc;
struct primitive_desc;
struct primitive_desc;
struct primitive_desc;
struct primitive_desc;
struct primitive_desc;
struct primitive_desc;
struct primitive_desc;
struct primitive_desc;
struct primitive_desc;
struct primitive_desc;
struct primitive_desc;
struct primitive_desc;
struct primitive_desc;
struct primitive_desc;
struct primitive_desc;
struct primitive_desc;
struct rnn_primitive_desc_base;
struct primitive_desc;
struct primitive_desc;
struct primitive_desc;
struct primitive_desc;

Inherited Members

public:
    // methods

    handle();
    handle(const handle<T, traits>&);
    handle<T, traits>& operator = (const handle<T, traits>&);
    handle(handle<T, traits>&&);
    handle<T, traits>& operator = (handle<T, traits>&&);
    handle(T t, bool weak = false);
    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;
    primitive_desc_base();
    engine get_engine() const;
    const char* impl_info_str() const;
    memory::dim query_s64(query what) 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;

Detailed Documentation

A base class for descriptors of all primitives that have an operation descriptor and that support iteration over multiple implementations.

Methods

primitive_desc(
    const_dnnl_op_desc_t desc,
    const primitive_attr* attr,
    const engine& aengine,
    const_dnnl_primitive_desc_t hint_fwd_pd,
    bool allow_empty = false
    )

Constructs a primitive descriptor.

Note

If allow_empty is true, the constructor does not throw if a primitive descriptor cannot be created. But calling next_impl() in this case will throw.

This is a low-level implementation detail that is typically not needed in application code.

Parameters:

desc

Constant C API operation descriptor.

attr

Pointer to primitive attributes. It is safe to pass nullptr to indicate absence of attributes.

aengine

Engine to use.

hint_fwd_pd

C API primitive descriptor for a forward propagation primitive. It is used as a hint for deciding which memory format to use for backward propagation or weights gradient.

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.

bool next_impl()

Advances the primitive iterator to the next implementation.

Returns:

true on success, and false if the last implementation reached, and the primitive descriptor itself is kept unchanged