oneAPI Deep Neural Network Library (oneDNN)  1.4.0
Performance library for Deep Learning
Loading...
Searching...
No Matches
dnnl::primitive_desc_base Struct Reference

Base class for all primitive descriptors. More...

#include <dnnl.hpp>

Inheritance diagram for dnnl::primitive_desc_base:
Collaboration diagram for dnnl::primitive_desc_base:

Public Member Functions

 primitive_desc_base ()=default
 Default constructor. Produces an empty object.
engine get_engine () const
 Returns the engine of the primitive descriptor.
const char * impl_info_str () const
 Returns implementation name.
memory::dim query_s64 (query what) const
 Returns a memory::dim value (same as int64_t).
memory::desc query_md (query what, int idx=0) const
 Returns a memory descriptor.
memory::desc src_desc (int idx) const
 Returns a source memory descriptor.
memory::desc dst_desc (int idx) const
 Returns a destination memory descriptor.
memory::desc weights_desc (int idx) const
 Returns a weights memory descriptor.
memory::desc diff_src_desc (int idx) const
 Returns a diff source memory descriptor.
memory::desc diff_dst_desc (int idx) const
 Returns a diff destination memory descriptor.
memory::desc diff_weights_desc (int idx) const
 Returns a diff weights memory descriptor.
memory::desc src_desc () const
 Returns a source memory descriptor.
memory::desc dst_desc () const
 Returns a destination memory descriptor.
memory::desc weights_desc () const
 Returns a weights memory descriptor.
memory::desc diff_src_desc () const
 Returns a diff source memory descriptor.
memory::desc diff_dst_desc () const
 Returns a diff destination memory descriptor.
memory::desc diff_weights_desc () const
 Returns a diff weights memory descriptor.
memory::desc workspace_desc () const
 Returns the workspace memory descriptor.
memory::desc scratchpad_desc () const
 Returns the scratchpad memory descriptor.
engine scratchpad_engine () const
 Returns the engine on which the scratchpad memory is located.
primitive_attr get_primitive_attr () const
 Returns the primitive attributes.
dnnl::primitive::kind get_kind () const
 Returns the kind of the primitive descriptor.
Public Member Functions inherited from dnnl::handle< dnnl_primitive_desc_t >
 handle ()=default
 Constructs an empty handle object.
handle< dnnl_primitive_desc_t, handle_traits< dnnl_primitive_desc_t > > & operator= (const handle< dnnl_primitive_desc_t, handle_traits< dnnl_primitive_desc_t > > &)=default
 Assignment operator.
void reset (dnnl_primitive_desc_t t, bool weak=false)
 Resets the handle wrapper objects to wrap a new C API handle.
dnnl_primitive_desc_t get (bool allow_empty=false) const
 Returns the underlying C API handle.
 operator dnnl_primitive_desc_t () const
 Converts a handle to the underlying C API handle type.
 operator bool () const
 Checks whether the object is empty.

Protected Member Functions

void reset_with_clone (const_dnnl_primitive_desc_t pd)
 Resets the value of the handle to a clone of a C API primitive descriptor.
 primitive_desc_base (dnnl_primitive_desc_t pd, dnnl::primitive::kind prim_kind)
 Constructs a primitive descriptor base object from a clone of a C API primitive descriptor after verifying that it is what the caller expects.
 primitive_desc_base (dnnl_primitive_desc_t pd, dnnl::primitive::kind prim_kind, dnnl::prop_kind prop_kind)
 Constructs a primitive descriptor base object from a clone of a C API primitive descriptor after verifying that it is what the caller expects.
 primitive_desc_base (dnnl_primitive_desc_t pd, dnnl::primitive::kind prim_kind, dnnl::prop_kind prop_kind1, dnnl::prop_kind prop_kind2)
 Constructs a primitive descriptor base object from a clone of a C API primitive descriptor after verifying that it is what the caller expects.

Detailed Description

Base class for all primitive descriptors.

Constructor & Destructor Documentation

◆ primitive_desc_base() [1/3]

dnnl::primitive_desc_base::primitive_desc_base ( dnnl_primitive_desc_t pd,
dnnl::primitive::kind prim_kind )
inlineprotected

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. dnnl::binary).
Primitive descriptor base constructed this way does not support next_impl() (will throw).
Parameters
pdC API primitive descriptor to clone.
prim_kindExpected primitive kind.

◆ primitive_desc_base() [2/3]

dnnl::primitive_desc_base::primitive_desc_base ( dnnl_primitive_desc_t pd,
dnnl::primitive::kind prim_kind,
dnnl::prop_kind prop_kind )
inlineprotected

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 next_impl() (will throw).
Parameters
pdC API primitive descriptor to clone.
prim_kindExpected primitive kind.
prop_kindExpected propagation kind.

◆ primitive_desc_base() [3/3]

dnnl::primitive_desc_base::primitive_desc_base ( dnnl_primitive_desc_t pd,
dnnl::primitive::kind prim_kind,
dnnl::prop_kind prop_kind1,
dnnl::prop_kind prop_kind2 )
inlineprotected

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 next_impl() (will throw).
Parameters
pdC API primitive descriptor to clone.
prim_kindExpected primitive kind.
prop_kind1Expected propagation kind (option 1).
prop_kind2Expected propagation kind (option 2). This value is checked if the check with prop_kind1 fails.

Member Function Documentation

◆ get_engine()

engine dnnl::primitive_desc_base::get_engine ( ) const
inline

Returns the engine of the primitive descriptor.

Returns
The engine of the primitive descriptor.

◆ impl_info_str()

const char * dnnl::primitive_desc_base::impl_info_str ( ) const
inline

Returns implementation name.

Returns
The implementation name.

◆ query_s64()

memory::dim dnnl::primitive_desc_base::query_s64 ( query what) const
inline

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

Parameters
whatThe value to query.
Returns
The result of the query.

◆ query_md()

memory::desc dnnl::primitive_desc_base::query_md ( query what,
int idx = 0 ) const
inline

Returns a memory descriptor.

Note
See also the convenience methods dnnl::primitive_desc_base::src_desc(), dnnl::primitive_desc_base::dst_desc(), and others.
Parameters
whatThe kind of parameter to query; can be dnnl::query::src_md, dnnl::query::dst_md, etc.
idxIndex 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.

◆ src_desc() [1/2]

memory::desc dnnl::primitive_desc_base::src_desc ( int idx) const
inline

Returns a source memory descriptor.

Parameters
idxSource index.
Returns
Source memory descriptor.
A zero memory descriptor if the primitive does not have a source parameter with index pdx.

◆ dst_desc() [1/2]

memory::desc dnnl::primitive_desc_base::dst_desc ( int idx) const
inline

Returns a destination memory descriptor.

Parameters
idxDestination index.
Returns
Destination memory descriptor.
A zero memory descriptor if the primitive does not have a destination parameter with index pdx.

◆ weights_desc() [1/2]

memory::desc dnnl::primitive_desc_base::weights_desc ( int idx) const
inline

Returns a weights memory descriptor.

Parameters
idxWeights index.
Returns
Weights memory descriptor.
A zero memory descriptor if the primitive does not have a weights parameter with index pdx.
Examples
memory_format_propagation.cpp.

◆ diff_src_desc() [1/2]

memory::desc dnnl::primitive_desc_base::diff_src_desc ( int idx) const
inline

Returns a diff source memory descriptor.

Parameters
idxDiff source index.
Returns
Diff source memory descriptor.
A zero memory descriptor if the primitive does not have a diff source parameter with index pdx.

◆ diff_dst_desc() [1/2]

memory::desc dnnl::primitive_desc_base::diff_dst_desc ( int idx) const
inline

Returns a diff destination memory descriptor.

Parameters
idxDiff destination index.
Returns
Diff destination memory descriptor.
A zero memory descriptor if the primitive does not have a diff destination parameter with index pdx.

◆ diff_weights_desc() [1/2]

memory::desc dnnl::primitive_desc_base::diff_weights_desc ( int idx) const
inline

Returns a diff weights memory descriptor.

Parameters
idxDiff weights index.
Returns
Diff weights memory descriptor.
A zero memory descriptor if the primitive does not have a diff weights parameter with index pdx.

◆ src_desc() [2/2]

memory::desc dnnl::primitive_desc_base::src_desc ( ) const
inline

Returns a source memory descriptor.

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

◆ dst_desc() [2/2]

memory::desc dnnl::primitive_desc_base::dst_desc ( ) const
inline

Returns a destination memory descriptor.

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

◆ weights_desc() [2/2]

memory::desc dnnl::primitive_desc_base::weights_desc ( ) const
inline

Returns a weights memory descriptor.

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

◆ diff_src_desc() [2/2]

memory::desc dnnl::primitive_desc_base::diff_src_desc ( ) const
inline

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.

◆ diff_dst_desc() [2/2]

memory::desc dnnl::primitive_desc_base::diff_dst_desc ( ) const
inline

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.

◆ diff_weights_desc() [2/2]

memory::desc dnnl::primitive_desc_base::diff_weights_desc ( ) const
inline

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.

◆ workspace_desc()

memory::desc dnnl::primitive_desc_base::workspace_desc ( ) const
inline

Returns the workspace memory descriptor.

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

◆ scratchpad_desc()

memory::desc dnnl::primitive_desc_base::scratchpad_desc ( ) const
inline

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
Examples
memory_format_propagation.cpp.

◆ scratchpad_engine()

engine dnnl::primitive_desc_base::scratchpad_engine ( ) const
inline

Returns the engine on which the scratchpad memory is located.

Returns
The engine on which the scratchpad memory is located.

◆ get_primitive_attr()

primitive_attr dnnl::primitive_desc_base::get_primitive_attr ( ) const
inline

Returns the primitive attributes.

Returns
The primitive attributes.

◆ get_kind()

dnnl::primitive::kind dnnl::primitive_desc_base::get_kind ( ) const
inline

Returns the kind of the primitive descriptor.

Returns
The kind of the primitive descriptor.

◆ reset_with_clone()

void dnnl::primitive_desc_base::reset_with_clone ( const_dnnl_primitive_desc_t pd)
inlineprotected

Resets the value of the handle to a clone of a C API primitive descriptor.

Parameters
pdA C API primitive descriptor to clone.

The documentation for this struct was generated from the following file: