Memory that describes the data. More...
#include <mkldnn.hpp>
Classes | |
struct | desc |
A memory descriptor. More... | |
Public Types | |
enum | data_type { data_type::undef = mkldnn_data_type_undef, data_type::f16 = mkldnn_f16, data_type::bf16 = mkldnn_bf16, data_type::f32 = mkldnn_f32, data_type::s32 = mkldnn_s32, data_type::s8 = mkldnn_s8, data_type::u8 = mkldnn_u8 } |
Data type specification. More... | |
enum | format_kind { format_kind::undef = mkldnn_format_kind_undef, format_kind::any = mkldnn_format_kind_any, format_kind::blocked = mkldnn_blocked, format_kind::wino = mkldnn_format_kind_wino, format_kind::packed = mkldnn_format_kind_rnn_packed } |
Memory format kind. More... | |
enum | format_tag { format_tag::undef = mkldnn_format_tag_undef, format_tag::any = mkldnn_format_tag_any, format_tag::a = mkldnn_a, format_tag::ab = mkldnn_ab, format_tag::abc = mkldnn_abc, format_tag::abcd = mkldnn_abcd, format_tag::abcde = mkldnn_abcde, format_tag::abcdef = mkldnn_abcdef, format_tag::abdec = mkldnn_abdec, format_tag::acb = mkldnn_acb, format_tag::acbde = mkldnn_acbde, format_tag::acdb = mkldnn_acdb, format_tag::acdeb = mkldnn_acdeb, format_tag::ba = mkldnn_ba, format_tag::bac = mkldnn_bac, format_tag::bacd = mkldnn_bacd, format_tag::bcda = mkldnn_bcda, format_tag::cba = mkldnn_cba, format_tag::cdba = mkldnn_cdba, format_tag::cdeba = mkldnn_cdeba, format_tag::decab = mkldnn_decab , format_tag::aBcd8b = mkldnn_aBcd8b , format_tag::ABcd8b8a = mkldnn_ABcd8b8a , format_tag::nc = mkldnn_nc , format_tag::nchw = mkldnn_nchw, format_tag::nhwc = mkldnn_nhwc, format_tag::chwn = mkldnn_chwn } |
Memory format tag specification. More... | |
Public Member Functions | |
memory (const desc &md, const engine &aengine, void *ahandle) | |
Constructs a memory. More... | |
memory (const desc &md, const engine &aengine) | |
Constructs a memory. More... | |
desc | get_desc () const |
Returns the descriptor of the memory. | |
engine | get_engine () const |
Returns the engine of the memory. | |
void * | get_data_handle () const |
Returns a handle of the data contained in the memory. More... | |
template<typename T = void> | |
T * | map_data () const |
Maps the data of the memory. More... | |
void | unmap_data (void *mapped_ptr) const |
Unmaps the previously mapped data for the memory. More... | |
Public Member Functions inherited from mkldnn::handle< mkldnn_memory_t > | |
handle (mkldnn_memory_t t, bool weak=false) | |
Constructs a C handle wrapper. More... | |
handle () | |
Empty constructor. More... | |
void | reset (mkldnn_memory_t t, bool weak=false) |
Resets the value of a C handle. More... | |
mkldnn_memory_t | get (bool allow_emtpy=false) const |
Returns the value of the underlying C handle. | |
Memory that describes the data.
|
strong |
Data type specification.
|
strong |
Memory format kind.
Enumerator | |
---|---|
undef | Undefined memory format kind, used for empty memory descriptors. |
any | Unspecified format kind. The primitive selects a format automatically. |
blocked | A tensor in a generic format described by the stride and blocking values in each dimension. See mkldnn_blocking_desc_t for more information. |
wino | Weights format used in 8bit Winograd convolution. |
packed | Packed weights format used in RNN. |
|
strong |
Memory format tag specification.
See mkldnn_format_tag_t for a detailed description.
Enumerator | |
---|---|
undef | Undefined memory format tag. |
any | Placeholder memory format tag. The primitive selects a format automatically. |
a | plain 1D tensor |
ab | plain 2D tensor |
abc | plain 3D tensor |
abcd | plain 4D tensor |
abcde | plain 5D tensor |
abcdef | plain 6D tensor |
abdec | permuted 5D tensor |
acb | permuted 3D tensor |
acbde | permuted 5D tensor |
acdb | permuted 4D tensor |
acdeb | permuted 5D tensor |
ba | permuted 2D tensor |
bac | permuted 3D tensor |
bacd | permuted 4D tensor |
bcda | permuted 4D tensor |
cba | permuted 3D tensor |
cdba | permuted 4D tensor |
cdeba | permuted 5D tensor |
decab | permuted 5D tensor |
aBcd8b | 4D tensor blocked by 2nd dimension with block size 8 |
ABcd8b8a | 4D tensor blocked by 1st and 2nd dimension with block size 8 |
nc | 2D CNN activations tensor, an alias to mkldnn::memory::format_tag::ab |
nchw | 4D CNN activations tensor, an alias to mkldnn::memory::format_tag::abcd |
nhwc | 4D CNN activations tensor, an alias to mkldnn::memory::format_tag::acdb |
chwn | 4D CNN activations tensor, an alias to mkldnn::memory::format_tag::bcda |
Constructs a memory.
md | Memory descriptor. |
aengine | Engine. |
ahandle | handle. |
Constructs a memory.
md | Memory descriptor. |
aengine | Engine. |
|
inline |
Returns a handle of the data contained in the memory.
On the CPU engine, this is a pointer to the allocated memory.
|
inline |
Maps the data of the memory.
Mapping allows to read/write directly from/to the memory contents for engines that do not support direct memory access.
Mapping is an exclusive operation - a memory object cannot be used in other operations until this memory object is unmapped.
T | Type of the pointer to be mapped. |
|
inline |
Unmaps the previously mapped data for the memory.
Any changes of the mapped data are synchronized back to the memory after the call is complete. The mapped pointer must be obtained through a map_data() call.