Memory that describes the data. More...
#include <dnnl.hpp>
Classes | |
struct | desc |
A memory descriptor. More... | |
Public Types | |
enum | data_type { data_type::undef = dnnl_data_type_undef, data_type::f16 = dnnl_f16, data_type::bf16 = dnnl_bf16, data_type::f32 = dnnl_f32, data_type::s32 = dnnl_s32, data_type::s8 = dnnl_s8, data_type::u8 = dnnl_u8 } |
Data type specification. More... | |
enum | format_kind { format_kind::undef = dnnl_format_kind_undef, format_kind::any = dnnl_format_kind_any, format_kind::blocked = dnnl_blocked, format_kind::wino = dnnl_format_kind_wino, format_kind::packed = dnnl_format_kind_rnn_packed } |
Memory format kind. More... | |
enum | format_tag { format_tag::undef = dnnl_format_tag_undef, format_tag::any = dnnl_format_tag_any, format_tag::a = dnnl_a, format_tag::ab = dnnl_ab, format_tag::abc = dnnl_abc, format_tag::abcd = dnnl_abcd, format_tag::abcde = dnnl_abcde, format_tag::abcdef = dnnl_abcdef, format_tag::abdec = dnnl_abdec, format_tag::acb = dnnl_acb, format_tag::acbde = dnnl_acbde, format_tag::acdb = dnnl_acdb, format_tag::acdeb = dnnl_acdeb, format_tag::ba = dnnl_ba, format_tag::bac = dnnl_bac, format_tag::bacd = dnnl_bacd, format_tag::bcda = dnnl_bcda, format_tag::cba = dnnl_cba, format_tag::cdba = dnnl_cdba, format_tag::cdeba = dnnl_cdeba, format_tag::decab = dnnl_decab , format_tag::aBcd8b = dnnl_aBcd8b , format_tag::ABcd8b8a = dnnl_ABcd8b8a , format_tag::nc = dnnl_nc , format_tag::nchw = dnnl_nchw, format_tag::nhwc = dnnl_nhwc, format_tag::chwn = dnnl_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... | |
cl_mem | get_ocl_mem_object () const |
Returns the OpenCL memory object associated with the memory. | |
void | set_ocl_mem_object (cl_mem mem_object) |
Sets the OpenCL memory object mem_object associated with the memory. | |
Public Member Functions inherited from dnnl::handle< dnnl_memory_t > | |
handle ()=default | |
Empty constructor. More... | |
handle (dnnl_memory_t t, bool weak=false) | |
Constructs a C handle wrapper from a C handle. More... | |
void | reset (dnnl_memory_t t, bool weak=false) |
Resets the value of a C handle. More... | |
dnnl_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 dnnl_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 dnnl_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 dnnl::memory::format_tag::ab |
nchw | 4D CNN activations tensor, an alias to dnnl::memory::format_tag::abcd |
nhwc | 4D CNN activations tensor, an alias to dnnl::memory::format_tag::acdb |
chwn | 4D CNN activations tensor, an alias to dnnl::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.