Caffe2 - C++ API
A deep learning, cross platform ML framework
Public Member Functions
caffe2::mkl::MKLMemory< T > Class Template Reference

A wrapper around an opaque MKL internal resource that has certain layouts and convertion primitives set up. More...

#include <mkl_memory.h>

Public Member Functions

 MKLMemory (const size_t dimension, const size_t size[], const size_t strides[], const dnnPrimitive_t primitive=nullptr, const dnnResourceType_t type=dnnResourceNumber, bool share_mem_if_possible=false)
 
template<typename IndexType >
 MKLMemory (const vector< IndexType > &dims, const dnnPrimitive_t primitive=nullptr, const dnnResourceType_t type=dnnResourceNumber, bool share_mem_if_possible=false)
 
void Reset (const size_t dimension, const size_t size[], const size_t strides[], const dnnPrimitive_t primitive=nullptr, const dnnResourceType_t type=dnnResourceNumber, bool share_mem_if_possible=false)
 
template<typename IndexType >
void Reset (const vector< IndexType > &dims, const dnnPrimitive_t primitive=nullptr, const dnnResourceType_t type=dnnResourceNumber, bool share_mem_if_possible=false)
 
void Reset ()
 
template<typename IndexType >
void Reshape (const vector< IndexType > &dims)
 Resizes the tensor without touching underlying storage. More...
 
void CopyFrom (const void *ptr)
 
void CopyFrom (const TensorCPU &tensor)
 
void CopyFrom (const MKLMemory< T > &other)
 
bool ShareFromRaw (const void *ptr)
 
bool ShareFromTensor (const TensorCPU &tensor)
 
bool ShareFrom (const MKLMemory< T > &other)
 
void CopyTo (void *ptr) const
 
void CopyTo (TensorCPU *tensor) const
 
void CopyTo (MKLMemory< T > *other, const dnnPrimitive_t primitive=nullptr, const dnnResourceType_t type=dnnResourceNumber)
 
void * buffer ()
 
void * buffer () const
 
const vector< TIndex > & dims () const
 
const int ndim () const
 
int dim32 (const int i) const
 
TIndex size () const
 Returns the size (i.e., the number of items) in the buffer.
 
TIndex dim (const int i) const
 Returns the i-th dimension of the tensor. More...
 
const LayoutWrapper< T > & layout () const
 
bool is_user_layout () const
 
std::shared_ptr< void > View (dnnLayout_t layout_wanted, dnnPrimitive_t primitive=nullptr, dnnResourceType_t type=dnnResourceNumber) const
 

Detailed Description

template<typename T>
class caffe2::mkl::MKLMemory< T >

A wrapper around an opaque MKL internal resource that has certain layouts and convertion primitives set up.

Most of the MKLMemory functions are not thread safe.

Definition at line 151 of file mkl_memory.h.

Member Function Documentation

template<typename T>
TIndex caffe2::mkl::MKLMemory< T >::dim ( const int  i) const
inline

Returns the i-th dimension of the tensor.

Note that the passed in index must be between 0 (inclusive) and the number of dimensions, otherwise this function will produce a fatal message.

Definition at line 482 of file mkl_memory.h.

template<typename T>
template<typename IndexType >
void caffe2::mkl::MKLMemory< T >::Reshape ( const vector< IndexType > &  dims)
inline

Resizes the tensor without touching underlying storage.

This requires the total size of the tensor to remains constant.

Definition at line 267 of file mkl_memory.h.


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