Represents real host memory allocated for a Tensor/Blob per C type. More...
#include <ie_blob.h>
Public Types | |
using | Ptr = std::shared_ptr< TBlob< T >> |
Smart Pointer to this TBlob object. |
|
Public Types inherited from InferenceEngine::MemoryBlob | |
using | Ptr = std::shared_ptr< MemoryBlob > |
A smart pointer to the MemoryBlob object. |
|
using | CPtr = std::shared_ptr< const MemoryBlob > |
A smart pointer to the const MemoryBlob object. |
|
Public Types inherited from InferenceEngine::Blob | |
using | Ptr = std::shared_ptr< Blob > |
A smart pointer containing Blob object. |
|
using | CPtr = std::shared_ptr< const Blob > |
A smart pointer to the const Blob object. |
|
Public Member Functions | |
TBlob (const TensorDesc &tensorDesc) | |
Creates a TBlob object with the specified dimensions and layout but does not allocate the memory. Use the allocate() method to allocate memory. More... |
|
TBlob (const TensorDesc &tensorDesc, T *ptr, size_t data_size=0) | |
The constructor creates a TBlob object with the specified dimensions and layout on the pre-allocated memory. The allocate() call is not required. More... |
|
TBlob (const TensorDesc &tensorDesc, const std::shared_ptr< IAllocator > &alloc) | |
Creates a TBlob object with the specified dimensions, layout and custom memory allocator but does not allocate the memory. More... |
|
TBlob (const TBlob< T > &blob) | |
The copy constructor data is reallocated and copied from the source to the target blob. More... |
|
TBlob (TBlob< T > &&blob) | |
A move constructor. More... |
|
TBlob & | operator= (const TBlob &blob) |
Copy operator for the TBlob object. More... |
|
virtual | ~TBlob () |
Virtual destructor. |
|
size_t | element_size () const noexcept override |
Gets the size of the given type. More... |
|
virtual LockedMemory< T > | data () noexcept |
Creates an new empty rvalue LockedMemory object. More... |
|
virtual LockedMemory< const T > | readOnly () const noexcept |
Creates a new empty rvalue read-only LockedMemory object. More... |
|
void | allocate () noexcept override |
Allocates or reallocates memory. |
|
bool | deallocate () noexcept override |
Frees all allocated data. |
|
LockedMemory< void > | buffer () noexcept override |
Creates a new LockedMemory instance holding void pointer. More... |
|
LockedMemory< const void > | cbuffer () const noexcept override |
Creates a new LockedMemory instance holding constant void pointer. More... |
|
details::BlobIterator< T > | begin () |
Gets BlobIterator for the data. Enables a ranged loop support for the TBlob object. More... |
|
details::BlobIterator< T > | end () |
Gets BlobIterator for the end of data. Enables a ranged loop support for the TBlob object. More... |
|
details::BlobIterator< const T > | begin () const |
Gets a const BlobIterator for the read-only data. Enables a ranged loop support for the TBlob object. More... |
|
details::BlobIterator< const T > | end () const |
Gets a const BlobIterator for the end of read-only data. Enables a ranged loop support for the TBlob object. More... |
|
Public Member Functions inherited from InferenceEngine::MemoryBlob | |
virtual | ~MemoryBlob () |
MemoryBlob virtual destructor. |
|
MemoryBlob (const TensorDesc &tensorDesc) | |
Constructor. Creates an empty MemoryBlob object with the specified precision. More... |
|
const TensorDesc & | getTensorDesc () const noexcept override |
Returns the tensor description. |
|
TensorDesc & | getTensorDesc () noexcept override |
Returns the tensor description. |
|
size_t | size () const noexcept override |
Returns the total number of elements, which is a product of all the dimensions. |
|
size_t | byteSize () const noexcept override |
Returns the size of the current Blob in bytes. |
|
Public Member Functions inherited from InferenceEngine::Blob | |
virtual | ~Blob () |
Blob virtual destructor. |
|
template<typename T , typename std::enable_if<!std::is_pointer< T >::value &&!std::is_reference< T >::value, int >::type = 0, typename std::enable_if< std::is_base_of< Blob, T >::value, int >::type = 0> | |
bool | is () noexcept |
Checks if the Blob object can be cast to the type T*. More... |
|
template<typename T , typename std::enable_if<!std::is_pointer< T >::value &&!std::is_reference< T >::value, int >::type = 0, typename std::enable_if< std::is_base_of< Blob, T >::value, int >::type = 0> | |
bool | is () const noexcept |
Checks if the Blob object can be cast to the type const T*. More... |
|
template<typename T , typename std::enable_if<!std::is_pointer< T >::value &&!std::is_reference< T >::value, int >::type = 0, typename std::enable_if< std::is_base_of< Blob, T >::value, int >::type = 0> | |
T * | as () noexcept |
Casts this Blob object to the type T*. Use InferenceEngine::as() to operate with shared Blob objects instead of raw pointers. More... |
|
template<typename T , typename std::enable_if<!std::is_pointer< T >::value &&!std::is_reference< T >::value, int >::type = 0, typename std::enable_if< std::is_base_of< Blob, T >::value, int >::type = 0> | |
const T * | as () const noexcept |
Casts this Blob object to the type const T*. Use InferenceEngine::as() to operate with shared Blob objects instead of raw pointers. More... |
|
Blob (const TensorDesc &tensorDesc) | |
Constructor. Creates an empty Blob object with the specified precision. More... |
|
Protected Member Functions | |
void | copyFrom (const TBlob< T > &blob) |
Copies dimensions and data from the TBlob object. More... |
|
template<class U > | |
void | moveFrom (TBlob< U > &blob) |
Swaps memory handlers between the current blob and the given one. More... |
|
virtual bool | free () |
Frees handler and cleans up the stored data. |
|
template<class S > | |
LockedMemory< S > | lockme () const |
Creates a LockedMemory instance. More... |
|
const std::shared_ptr< IAllocator > & | getAllocator () const noexcept override |
Gets an allocator or creates a default one. More... |
|
void * | getHandle () const noexcept override |
Returns handle to the stored data. |
|
Protected Attributes | |
std::shared_ptr< IAllocator > | _allocator |
Local instance of IAllocator to manipulate memory. |
|
void * | _handle = nullptr |
A handle for the stored memory returned from _allocator.alloc(). |
|
Protected Attributes inherited from InferenceEngine::Blob | |
TensorDesc | tensorDesc |
The tensor descriptor of the given blob. |
|
Friends | |
template<typename , typename > | |
class | TBlob |
Additional Inherited Members | |
Static Public Member Functions inherited from InferenceEngine::Blob | |
static Ptr | CreateFromData (const DataPtr &data) |
Creates a TBlob<> object from a Data node. More... |
|
Static Protected Member Functions inherited from InferenceEngine::Blob | |
static size_t | product (const SizeVector &dims) noexcept |
Multiplies the dimension vector's values. More... |
|
Represents real host memory allocated for a Tensor/Blob per C type.
|
inlineexplicit |
Creates a TBlob object with the specified dimensions and layout but does not allocate the memory. Use the allocate() method to allocate memory.
tensorDesc | Tensor description |
|
inline |
The constructor creates a TBlob object with the specified dimensions and layout on the pre-allocated memory. The allocate() call is not required.
tensorDesc | Tensor description |
ptr | Pointer to the pre-allocated memory |
data_size | Length of the pre-allocated array. If not set, size is assumed equal to the dot product of dims. |
|
inline |
|
inline |
The copy constructor data is reallocated and copied from the source to the target blob.
blob | Source blob |
|
inline |
A move constructor.
blob | rvalue to make a move from |
|
inline |
Gets BlobIterator for the data. Enables a ranged loop support for the TBlob object.
|
inline |
Gets a const BlobIterator for the read-only data. Enables a ranged loop support for the TBlob object.
|
inlineoverridevirtualnoexcept |
Creates a new LockedMemory instance holding void pointer.
Implements InferenceEngine::MemoryBlob.
|
inlineoverridevirtualnoexcept |
Creates a new LockedMemory instance holding constant void pointer.
Implements InferenceEngine::MemoryBlob.
|
inlineprotected |
Copies dimensions and data from the TBlob object.
blob | object reference to copy from |
|
inlinevirtualnoexcept |
Creates an new empty rvalue LockedMemory object.
|
inlineoverridevirtualnoexcept |
|
inline |
Gets BlobIterator for the end of data. Enables a ranged loop support for the TBlob object.
|
inline |
Gets a const BlobIterator for the end of read-only data. Enables a ranged loop support for the TBlob object.
|
inlineoverrideprotectedvirtualnoexcept |
Gets an allocator or creates a default one.
Implements InferenceEngine::MemoryBlob.
|
inlineprotected |
Creates a LockedMemory instance.
S | Type of the LockedMemory to be created |
|
inlineprotected |
Swaps memory handlers between the current blob and the given one.
U | Type of the blob to move from |
blob | TBlob instance to move from |
|
inline |
Copy operator for the TBlob object.
blob | object reference to copy from |
|
inlinevirtualnoexcept |
Creates a new empty rvalue read-only LockedMemory object.