A memory descriptor. More...
#include <dnnl.hpp>

Public Member Functions | |
| desc () | |
| Constructs a zero (empty) memory descriptor. | |
| desc (const memory::dims &dimsdims, data_typedata_type data_typedata_type, format_tagformat_tag format_tagformat_tag, bool allow_empty=false) | |
| Constructs a memory descriptor. | |
| desc (const memory::dims &dimsdims, data_typedata_type data_typedata_type, const memory::dims &strides, bool allow_empty=false) | |
| Constructs a memory descriptor by strides. | |
| desc (const dnnl_memory_desc_t &data) | |
| Constructs a memory descriptor from a C API data structure. | |
| desc | submemory_desc (const memory::dims &dimsdims, const memory::dims &offsets, bool allow_empty=false) const |
| Constructs a memory descriptor for a region inside an area described by this memory descriptor. | |
| desc | reshape (const memory::dims &dimsdims, bool allow_empty=false) const |
| Constructs a memory descriptor by reshaping an existing one. | |
| desc | permute_axes (const std::vector< int > &permutation, bool allow_empty=false) const |
| Constructs a memory descriptor by permuting axes in an existing one. | |
| memory::dims | dims () const |
| Returns dimensions of the memory descriptor. | |
| memory::data_type | data_type () const |
| Returns the data type of the memory descriptor. | |
| size_t | get_size () const |
| Returns size of the memory descriptor in bytes. | |
| bool | is_zero () const |
| Checks whether the memory descriptor is zero (empty). | |
| bool | operator== (const desc &other) const |
| An equality operator. | |
| bool | operator!= (const desc &other) const |
| An inequality operator. | |
Public Attributes | |
| dnnl_memory_desc_t | data |
| The underlying C API data structure. | |
A memory descriptor.
|
inline |
Constructs a zero (empty) memory descriptor.
Such a memory descriptor can be used to indicate absence of an argument.
|
inline |
Constructs a memory descriptor.
| dims | Tensor dimensions. |
| data_type | Data precision/type. |
| format_tag | Memory format tag. |
| allow_empty | A flag signifying whether construction is allowed to fail without throwing an exception. In this case a zero memory descriptor will be constructed. This flag is optional and defaults to false. |
|
inline |
Constructs a memory descriptor by strides.
| dims | Tensor dimensions. |
| data_type | Data precision/type. |
| strides | Strides for each dimension. |
| allow_empty | A flag signifying whether construction is allowed to fail without throwing an exception. In this case a zero memory descriptor will be constructed. This flag is optional and defaults to false. |
|
inline |
Constructs a memory descriptor from a C API data structure.
| data | A C API dnnl_memory_desc_t structure. |
|
inline |
Constructs a memory descriptor for a region inside an area described by this memory descriptor.
| dims | Sizes of the region. |
| offsets | Offsets to the region from the encompassing memory object in each dimension. |
| allow_empty | A flag signifying whether construction is allowed to fail without throwing an exception. In this case a zero memory descriptor will be returned. This flag is optional and defaults to false. |
|
inline |
Constructs a memory descriptor by reshaping an existing one.
The new memory descriptor inherits the data type. This operation is valid only for memory descriptors that have format_kind set to dnnl::memory::format_kind::blocked or dnnl::memory::format_kind::any.
The operation ensures that the transformation of the physical memory format corresponds to the transformation of the logical dimensions. If such transformation is impossible, the function either throws an exception (default) or returns a zero memory descriptor depending on the allow_empty flag.
The reshape operation can be described as a combination of the following basic operations:
| dims | New dimensions. The product of dimensions must remain constant. |
| allow_empty | A flag signifying whether construction is allowed to fail without throwing an exception. In this case a zero memory descriptor will be returned. This flag is optional and defaults to false. |
|
inline |
Constructs a memory descriptor by permuting axes in an existing one.
The physical memory layout representation is adjusted accordingly to maintain the consistency between the logical and physical parts of the memory descriptor.
The new memory descriptor inherits the data type. This operation is valid only for memory descriptors that have format_kind set to dnnl::memory::format_kind::blocked or dnnl::memory::format_kind::any.
The logical axes will be permuted in the following manner:
Example:
| permutation | Axes permutation. |
| allow_empty | A flag signifying whether construction is allowed to fail without throwing an exception. In this case a zero memory descriptor will be returned. This flag is optional and defaults to false. |
|
inline |
Returns dimensions of the memory descriptor.
Potentially expensive due to the data copy involved.
|
inline |
Returns the data type of the memory descriptor.
|
inline |
Returns size of the memory descriptor in bytes.
|
inline |
Checks whether the memory descriptor is zero (empty).
true if the memory descriptor describes an empty memory and false otherwise.
|
inline |
An equality operator.
| other | Another memory descriptor. |
|
inline |
An inequality operator.
| other | Another memory descriptor. |