Public Types | Public Member Functions | Protected Member Functions | Friends
InferenceEngine::MemoryBlob Class Referenceabstract

This class implements a container object that represents a tensor in memory (host and remote/accelerated) More...

#include <ie_blob.h>

Inheritance diagram for InferenceEngine::MemoryBlob:
Inheritance graph
[legend]
Collaboration diagram for InferenceEngine::MemoryBlob:
Collaboration graph
[legend]

Public Types

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

virtual ~MemoryBlob ()=default
 MemoryBlob virtual destructor.
 
 MemoryBlob (const TensorDesc &tensorDesc)
 Constructor. Creates an empty MemoryBlob object with the specified precision. More...
 
const TensorDescgetTensorDesc () const noexcept override
 Returns the tensor description.
 
TensorDescgetTensorDesc () 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.
 
size_t element_size () const noexcept override=0
 Returns the number of bytes per element. The overall MemoryBlob capacity is size() * element_size(). Abstract method.
 
void allocate () noexcept override=0
 Allocates memory to store the data. Abstract method.
 
bool deallocate () noexcept override=0
 Releases previously allocated data. Abstract method.
 
LockedMemory< void > buffer () noexcept override=0
 Gets access to the allocated memory. Abstract method. More...
 
LockedMemory< const void > cbuffer () const noexcept override=0
 Gets read-only access to the allocated memory. Abstract method. More...
 
- Public Member Functions inherited from InferenceEngine::Blob
Precision type () const noexcept
 Returns the tensor precision of the current Blob object. More...
 
Precision precision () const noexcept
 Returns the tensor precision of the current Blob object. More...
 
Layout layout () const noexcept
 Returns the tensor layout of the current Blob object. More...
 
virtual ~Blob ()=default
 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...
 
 Blob (Precision p)
 Constructor. Creates an empty Blob object with the specified precision. More...
 
 Blob (Precision p, Layout l)
 The constructor creates an empty Blob object with the specified precision and layout. More...
 
 Blob (Precision p, const SizeVector &dims)
 The constructor creates an empty Blob object with the specified precision and dimensions. More...
 
 Blob (Precision p, Layout l, const SizeVector &dims)
 The constructor creates an empty Blob object with the specified precision, layout and dimensions. More...
 
size_t Resize (const SizeVector &dims, Layout layout=Layout::ANY) noexcept
 Changes Tensor size to the specified dimensions. If it was allocated, the previous data is deallocated and lost. More...
 
size_t Reshape (const SizeVector &dims, Layout layout=Layout::ANY) noexcept
 Changes tensor size to the specified dimensions without changing memory. The total size remains unchanged as well as the memory layout. More...
 
const SizeVector dims () const noexcept
 Returns the tensor dimensions vector with reversed order. More...
 

Protected Member Functions

const std::shared_ptr< IAllocator > & getAllocator () const noexcept override=0
 Gets the allocator for allocator-based blobs. More...
 
void * getHandle () const noexcept override=0
 Gets the handle to allocated memory. More...
 

Friends

template<typename >
class TBlobProxy
 

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...
 
- Protected Attributes inherited from InferenceEngine::Blob
TensorDesc tensorDesc
 The tensor descriptor of the given blob.
 

Detailed Description

This class implements a container object that represents a tensor in memory (host and remote/accelerated)

Note
Any Blob implementation that represents a concept of a tensor in memory (for example, TBlob) must be a subclass of MemoryBlob instead of Blob

Constructor & Destructor Documentation

§ MemoryBlob()

InferenceEngine::MemoryBlob::MemoryBlob ( const TensorDesc tensorDesc)
inlineexplicit

Constructor. Creates an empty MemoryBlob object with the specified precision.

Parameters
tensorDescDefines the layout and dims of the blob

Member Function Documentation

§ buffer()

LockedMemory<void> InferenceEngine::MemoryBlob::buffer ( )
overridepure virtualnoexcept

Gets access to the allocated memory. Abstract method.

Returns
A LockedMemory object

Implements InferenceEngine::Blob.

Implemented in InferenceEngine::TBlob< T, typename >.

§ cbuffer()

LockedMemory<const void> InferenceEngine::MemoryBlob::cbuffer ( ) const
overridepure virtualnoexcept

Gets read-only access to the allocated memory. Abstract method.

Returns
A LockedMemory object

Implements InferenceEngine::Blob.

Implemented in InferenceEngine::TBlob< T, typename >.

§ getAllocator()

const std::shared_ptr<IAllocator>& InferenceEngine::MemoryBlob::getAllocator ( ) const
overrideprotectedpure virtualnoexcept

Gets the allocator for allocator-based blobs.

Returns
The allocator for allocator-based blobs or if there is none then a nullptr.

Implements InferenceEngine::Blob.

Implemented in InferenceEngine::TBlob< T, typename >.

§ getHandle()

void* InferenceEngine::MemoryBlob::getHandle ( ) const
overrideprotectedpure virtualnoexcept

Gets the handle to allocated memory.

Returns
The handle to allocated memory for allocator-based blobs or if there is none then a nullptr.

Implements InferenceEngine::Blob.

Implemented in InferenceEngine::TBlob< T, typename >.


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