Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Friends
InferenceEngine::Blob 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::Blob:
Inheritance graph
[legend]
Collaboration diagram for InferenceEngine::Blob:
Collaboration graph
[legend]

Public Types

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

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.
 
  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...
 
const TensorDesc getTensorDesc () const noexcept
  Returns the tensor description.
 
size_t  size () const noexcept
  Returns the total number of elements (a product of all the dims)
 
size_t  byteSize () const noexcept
  Returns the size of the current Blob in bytes.
 
virtual size_t  element_size () const noexcept=0
  Returns the number of bytes per element. The overall Blob capacity is size() * element_size(). Abstract method.
 
virtual void  allocate () noexcept=0
  Allocates memory to store the data. Abstract method.
 
virtual bool  deallocate () noexcept=0
  Releases previously allocated data. Abstract method.
 
virtual LockedMemory< void >  buffer () noexcept=0
  Gets access to the allocated memory. Abstract method. More...
 
virtual LockedMemory< const void >  cbuffer () const noexcept=0
  Gets read-only access to the allocated memory. Abstract method. More...
 

Static Public Member Functions

static Ptr  CreateFromData (const DataPtr &data)
  Creates a TBlob<> object from a Data node. More...
 

Protected Member Functions

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

Static Protected Member Functions

static size_t  product (const SizeVector &dims) noexcept
  Multiplies the dimension vector's values. More...
 

Protected Attributes

TensorDesc  tensorDesc
  The tensor descriptor of the given blob.
 

Friends

template<typename >
class  TBlobProxy
 

Detailed Description

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

Constructor & Destructor Documentation

§ Blob() [1/5]

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

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

Parameters
tensorDesc Defines the layout and dims of the blob

§ Blob() [2/5]

InferenceEngine::Blob::Blob ( Precision  p )
inlineexplicit

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

Deprecated:
Please use TensorDesc for Blob initialization
Parameters
p Precision type

§ Blob() [3/5]

InferenceEngine::Blob::Blob ( Precision  p,
Layout  l 
)
inline

The constructor creates an empty Blob object with the specified precision and layout.

Deprecated:
Please use TensorDesc for Blob initialization
Parameters
p Precision type
l Layout

§ Blob() [4/5]

InferenceEngine::Blob::Blob ( Precision  p,
const SizeVector dims 
)
inline

The constructor creates an empty Blob object with the specified precision and dimensions.

Deprecated:
Please use TensorDesc for Blob initialization
Parameters
p Tensor precision type
dims Tensor dimensions vector

§ Blob() [5/5]

InferenceEngine::Blob::Blob ( Precision  p,
Layout  l,
const SizeVector dims 
)
inline

The constructor creates an empty Blob object with the specified precision, layout and dimensions.

Deprecated:
Please use TensorDesc for Blob initialization
Parameters
p tensor precision type
l tensor layout
dims Tensor dimensions vector with reversed order

Member Function Documentation

§ buffer()

virtual LockedMemory<void> InferenceEngine::Blob::buffer ( )
pure virtualnoexcept

Gets access to the allocated memory. Abstract method.

Returns
A LockedMemory object

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

§ cbuffer()

virtual LockedMemory<const void> InferenceEngine::Blob::cbuffer ( ) const
pure virtualnoexcept

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

Returns
A LockedMemory object

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

§ CreateFromData()

static Ptr InferenceEngine::Blob::CreateFromData ( const DataPtr data )
static

Creates a TBlob<> object from a Data node.

Parameters
Data reference to a smart pointer of the Data node
Returns
Smart pointer to TBlob<> with the relevant C type to the precision of the data node

§ dims()

const SizeVector InferenceEngine::Blob::dims ( ) const
inlinenoexcept

Returns the tensor dimensions vector with reversed order.

Deprecated:
Please use TensorDesc for working with dimensions.

§ getAllocator()

virtual const std::shared_ptr<IAllocator>& InferenceEngine::Blob::getAllocator ( ) const
protectedpure virtualnoexcept

Gets the allocator for allocator-based blobs.

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

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

§ getHandle()

virtual void* InferenceEngine::Blob::getHandle ( ) const
protectedpure 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.

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

§ layout()

Layout InferenceEngine::Blob::layout ( ) const
inlinenoexcept

Returns the tensor layout of the current Blob object.

Deprecated:
Please use TensorDesc to get the current layout

§ precision()

Precision InferenceEngine::Blob::precision ( ) const
inlinenoexcept

Returns the tensor precision of the current Blob object.

Deprecated:
Please use TensorDesc to get the precision

§ product()

static size_t InferenceEngine::Blob::product ( const SizeVector dims )
inlinestaticprotectednoexcept

Multiplies the dimension vector's values.

Parameters
dims Reference to a vector with dimension values of type size_t
Returns
Result of multiplication

§ Reshape()

size_t InferenceEngine::Blob::Reshape ( const SizeVector dims,
Layout  layout = Layout::ANY 
)
inlinenoexcept

Changes tensor size to the specified dimensions without changing memory. The total size remains unchanged as well as the memory layout.

Deprecated:
It works with reversed dimensions. Please use TensorDescriptor.reshape().
Parameters
dims New dimensions to set
layout New layout to set
Returns
The total number of elements (a product of all the dims)

§ Resize()

size_t InferenceEngine::Blob::Resize ( const SizeVector dims,
Layout  layout = Layout::ANY 
)
inlinenoexcept

Changes Tensor size to the specified dimensions. If it was allocated, the previous data is deallocated and lost.

Deprecated:
It works with reversed dimensions. Please create a new blob if you want to change a size.
Parameters
dims New dimensions to set
layout New layout to set
Returns
Total number of elements (a product of all the dimensions)

§ type()

Precision InferenceEngine::Blob::type ( ) const
inlinenoexcept

Returns the tensor precision of the current Blob object.

Deprecated:
Please use TensorDesc to get the precision

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