.. index:: pair: struct; dnnl::primitive_desc .. _doxid-structdnnl_1_1primitive__desc: struct dnnl::primitive_desc =========================== .. toctree:: :hidden: Overview ~~~~~~~~ A base class for descriptors of all primitives that have an operation descriptor and that support iteration over multiple implementations. :ref:`More...` .. ref-code-block:: cpp :class: doxyrest-overview-code-block #include struct primitive_desc: public :ref:`dnnl::primitive_desc_base` { // construction :target:`primitive_desc`(); :ref:`primitive_desc`( :ref:`const_dnnl_op_desc_t` desc, const primitive_attr* attr, const :ref:`engine`& aengine, :ref:`const_dnnl_primitive_desc_t` hint_fwd_pd, bool allow_empty = false ); // methods bool :ref:`next_impl`(); :ref:`primitive_desc_base`(); :ref:`primitive_desc_base`(); :ref:`primitive_desc_base`(); :ref:`primitive_desc_base`(); }; // direct descendants struct :ref:`primitive_desc`; struct :ref:`primitive_desc`; struct :ref:`primitive_desc`; struct :ref:`primitive_desc`; struct :ref:`primitive_desc`; struct :ref:`primitive_desc`; struct :ref:`primitive_desc`; struct :ref:`primitive_desc`; struct :ref:`primitive_desc`; struct :ref:`primitive_desc`; struct :ref:`primitive_desc`; struct :ref:`primitive_desc`; struct :ref:`primitive_desc`; struct :ref:`primitive_desc`; struct :ref:`primitive_desc`; struct :ref:`primitive_desc`; struct :ref:`primitive_desc`; struct :ref:`primitive_desc`; struct :ref:`primitive_desc`; struct :ref:`primitive_desc`; struct :ref:`primitive_desc`; struct :ref:`primitive_desc`; struct :ref:`primitive_desc`; struct :ref:`primitive_desc`; struct :ref:`primitive_desc`; struct :ref:`primitive_desc`; struct :ref:`primitive_desc`; struct :ref:`primitive_desc`; struct :ref:`primitive_desc`; struct :ref:`primitive_desc`; struct :ref:`rnn_primitive_desc_base`; struct :ref:`primitive_desc`; struct :ref:`primitive_desc`; struct :ref:`primitive_desc`; struct :ref:`primitive_desc`; Inherited Members ----------------- .. ref-code-block:: cpp :class: doxyrest-overview-inherited-code-block public: // methods :ref:`handle`& :ref:`operator =` (const :ref:`handle`&); :ref:`handle`& :ref:`operator =` (:ref:`handle`&&); void :ref:`reset`(T t, bool weak = false); T :ref:`get`(bool allow_empty = false) const; :ref:`operator T` () const; :ref:`operator bool` () const; bool :ref:`operator ==` (const :ref:`handle`& other) const; bool :ref:`operator !=` (const :ref:`handle`& other) const; :ref:`engine` :ref:`get_engine`() const; const char* :ref:`impl_info_str`() const; :ref:`memory::dim` :ref:`query_s64`(:ref:`query` what) const; :ref:`memory::desc` :ref:`query_md`(:ref:`query` what, int idx = 0) const; :ref:`memory::desc` :ref:`src_desc`(int idx) const; :ref:`memory::desc` :ref:`dst_desc`(int idx) const; :ref:`memory::desc` :ref:`weights_desc`(int idx) const; :ref:`memory::desc` :ref:`diff_src_desc`(int idx) const; :ref:`memory::desc` :ref:`diff_dst_desc`(int idx) const; :ref:`memory::desc` :ref:`diff_weights_desc`(int idx) const; :ref:`memory::desc` :ref:`src_desc`() const; :ref:`memory::desc` :ref:`dst_desc`() const; :ref:`memory::desc` :ref:`weights_desc`() const; :ref:`memory::desc` :ref:`diff_src_desc`() const; :ref:`memory::desc` :ref:`diff_dst_desc`() const; :ref:`memory::desc` :ref:`diff_weights_desc`() const; :ref:`memory::desc` :ref:`workspace_desc`() const; :ref:`memory::desc` :ref:`scratchpad_desc`() const; :ref:`engine` :ref:`scratchpad_engine`() const; primitive_attr :ref:`get_primitive_attr`() const; :ref:`dnnl::primitive::kind` :ref:`get_kind`() const; .. _details-structdnnl_1_1primitive__desc: Detailed Documentation ~~~~~~~~~~~~~~~~~~~~~~ A base class for descriptors of all primitives that have an operation descriptor and that support iteration over multiple implementations. Construction ------------ .. index:: pair: function; primitive_desc .. _doxid-structdnnl_1_1primitive__desc_1a1d5b57166120c0204ee4bb86d310b9ab: .. ref-code-block:: cpp :class: doxyrest-title-code-block primitive_desc( :ref:`const_dnnl_op_desc_t` desc, const primitive_attr* attr, const :ref:`engine`& aengine, :ref:`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 :ref:`next_impl() ` in this case will throw. .. note:: This is a low-level implementation detail that is typically not needed in application code. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - 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. Methods ------- .. index:: pair: function; next_impl .. _doxid-structdnnl_1_1primitive__desc_1a841df469ca54c3de2d233e46f48322b2: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool next_impl() Advances the primitive iterator to the next implementation. .. rubric:: Returns: ``true`` on success, and ``false`` if the last implementation reached, and the primitive descriptor itself is kept unchanged .. index:: pair: function; primitive_desc_base .. _doxid-structdnnl_1_1primitive__desc_1a27780142d0880bb0ca678f7c5a1845b9: .. ref-code-block:: cpp :class: doxyrest-title-code-block primitive_desc_base() Default constructor. Produces an empty object. .. index:: pair: function; primitive_desc_base .. _doxid-structdnnl_1_1primitive__desc_1aae07f2f06d74537546c3056bd305dfbe: .. ref-code-block:: cpp :class: doxyrest-title-code-block primitive_desc_base() Constructs a primitive descriptor base object from a clone of a C API primitive descriptor after verifying that it is what the caller expects. .. note:: The ``prim_kind`` should map to a primitive that does not have different values of propagation kind (e.g. :ref:`dnnl::binary `). .. note:: Primitive descriptor base constructed this way does not support :ref:`next_impl() ` (will throw). .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - pd - C API primitive descriptor to clone. * - prim_kind - Expected primitive kind. .. index:: pair: function; primitive_desc_base .. _doxid-structdnnl_1_1primitive__desc_1af4eac2eea0fd4eb37c0c90ead14ad52b: .. ref-code-block:: cpp :class: doxyrest-title-code-block primitive_desc_base() Constructs a primitive descriptor base object from a clone of a C API primitive descriptor after verifying that it is what the caller expects. .. note:: Primitive descriptor base constructed this way does not support :ref:`next_impl() ` (will throw). .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - pd - C API primitive descriptor to clone. * - prim_kind - Expected primitive kind. * - aprop_kind - Expected propagation kind. .. index:: pair: function; primitive_desc_base .. _doxid-structdnnl_1_1primitive__desc_1aa4853f3190cac45b653e510b6eeed97a: .. ref-code-block:: cpp :class: doxyrest-title-code-block primitive_desc_base() Constructs a primitive descriptor base object from a clone of a C API primitive descriptor after verifying that it is what the caller expects. .. note:: Primitive descriptor base constructed this way does not support :ref:`next_impl() ` (will throw). .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - pd - C API primitive descriptor to clone. * - prim_kind - Expected primitive kind. * - prop_kind1 - Expected propagation kind (option 1). * - prop_kind2 - Expected propagation kind (option 2). This value is checked if the check with ``prop_kind1`` fails.