A memory descriptor.
More...
#include <dnnl.hpp>
A memory descriptor.
- Examples
- cnn_inference_f32.cpp, cnn_inference_int8.cpp, cnn_training_f32.cpp, cpu_cnn_training_bf16.cpp, cpu_matmul_quantization.cpp, cpu_rnn_inference_f32.cpp, cpu_rnn_inference_int8.cpp, cpu_sgemm_and_matmul.cpp, getting_started.cpp, gpu_opencl_interop.cpp, inference_int8_matmul.cpp, memory_format_propagation.cpp, performance_profiling.cpp, and rnn_training_f32.cpp.
◆ desc() [1/4]
dnnl::memory::desc::desc |
( |
| ) |
|
|
inline |
Constructs a zero (empty) memory descriptor.
Such a memory descriptor can be used to indicate absence of an argument.
◆ desc() [2/4]
Constructs a memory descriptor.
- Note
- As always, the logical order of dimensions corresponds to the
abc...
format tag, and the physical meaning of the dimensions depends on both the primitive that consumes the memory and the context of that consumption.
- Parameters
-
dims | Tensor dimensions. |
data_type | Data precision/type. |
format_tag | Memory format tag. |
◆ desc() [3/4]
Constructs a memory descriptor by strides.
- Note
- As always, the logical order of dimensions corresponds to the
abc...
format tag, and the physical meaning of the dimensions depends on both the primitive that consumes the memory and the context of that consumption.
- Parameters
-
dims | Tensor dimensions. |
data_type | Data precision/type. |
strides | The strides for each dimension. |
◆ desc() [4/4]
Constructs a memory descriptor from a C API data structure.
- Parameters
-
◆ submemory_desc()
Constructs a memory descriptor for a region inside an area described by this memory descriptor.
- Parameters
-
dims | Sizes of the region. |
offsets | Offsets to the region from the encompassing memory object in each dimension. |
- Returns
- A memory descriptor for the region.
- Examples
- cpu_rnn_inference_f32.cpp, and cpu_rnn_inference_int8.cpp.
◆ reshape()
Constructs a memory descriptor by reshaping existing one.
- Parameters
-
dims | New dimensions. The product of dimensions must remain constant. |
- Returns
- A new memory descriptor with new dimensions.
◆ dims()
Returns dimensions of the memory descriptor.
Potentially expensive due to the data copy involved.
- Returns
- A copy of the dimensions vector.
- Examples
- inference_int8_matmul.cpp.
◆ data_type()
Returns the data type of the memory descriptor.
- Returns
- The data type.
◆ get_size()
size_t dnnl::memory::desc::get_size |
( |
| ) |
const |
|
inline |
Returns size of the memory descriptor in bytes.
- Returns
- The number of bytes required to allocate a memory buffer for the memory object described by this memory descriptor including the padding area.
- Examples
- performance_profiling.cpp.
◆ is_zero()
bool dnnl::memory::desc::is_zero |
( |
| ) |
const |
|
inline |
Checks whether the memory descriptor is zero (empty).
- Returns
true
if the memory descriptor describes an empty memory and false
otherwise.
◆ operator==()
bool dnnl::memory::desc::operator== |
( |
const desc & |
other | ) |
const |
|
inline |
An equality operator.
- Parameters
-
other | Another memory descriptor. |
- Returns
- Whether this and the other memory descriptors have the same format tag, dimensions, strides, blocking, etc.
◆ operator!=()
bool dnnl::memory::desc::operator!= |
( |
const desc & |
other | ) |
const |
|
inline |
An inequality operator.
- Parameters
-
other | Another memory descriptor. |
- Returns
- Whether this and the other memory descriptors describe different memory.
The documentation for this struct was generated from the following file: