Class InferenceEngine::Blob¶
-
class Blob¶
This class represents a universal container in the Inference Engine.
Subclassed by InferenceEngine::CompoundBlob, InferenceEngine::MemoryBlob
Public Types
Public Functions
-
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>
inline bool is() noexcept¶ Checks if the Blob object can be cast to the type T*.
- Template Parameters
T – Type to be checked. Must represent a class derived from the Blob
- Returns
true if this object can be dynamically cast to the type T*. Otherwise, false
-
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>
inline bool is() const noexcept¶ Checks if the Blob object can be cast to the type const T*.
- Template Parameters
T – Type to be checked. Must represent a class derived from the Blob
- Returns
true if this object can be dynamically cast to the type const T*. Otherwise, false
-
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 && !std::is_same<RemoteBlob, T>::value, int>::type = 0>
inline T *as() noexcept¶ Casts this Blob object to the type T*.
Use InferenceEngine::as() to operate with shared Blob objects instead of raw pointers
- Template Parameters
T – Type to cast to. Must represent a class derived from the Blob
- Returns
Raw pointer to the object of the type T or nullptr on error
-
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_same<RemoteBlob, T>::value, int>::type = 0>
inline T *as() noexcept¶ Casts this Blob object to the type RemoteBlob.
Use InferenceEngine::as() to operate with shared Blob objects instead of raw pointers
- Template Parameters
T – Type to cast to. Must represent a class derived from the Blob
- Returns
Raw pointer to the object of the type T or nullptr on error
-
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 && !std::is_same<RemoteBlob, T>::value, int>::type = 0>
inline 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
- Template Parameters
T – Type to cast to. Must represent a class derived from the Blob
- Returns
Raw pointer to the object of the type const T or nullptr on error
-
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_same<RemoteBlob, T>::value, int>::type = 0>
inline const T *as() const noexcept¶ Casts this Blob object to the type RemoteBlob.
Use InferenceEngine::as() to operate with shared Blob objects instead of raw pointers
- Template Parameters
T – Type to cast to. Must represent a class derived from the Blob
- Returns
Raw pointer to the object of the type T or nullptr on error
-
inline explicit Blob(const TensorDesc &tensorDesc)¶
Constructor. Creates an empty Blob object with the specified precision.
- Parameters
tensorDesc – Defines the layout and dims of the blob
-
inline virtual const TensorDesc &getTensorDesc() const noexcept¶
Returns the tensor description.
- Returns
A const reference to a tensor descriptor
-
inline virtual TensorDesc &getTensorDesc() noexcept¶
Returns the tensor description.
- Returns
A reference to a tensor descriptor
-
inline virtual size_t size() const noexcept¶
By default, returns the total number of elements (a product of all the dims or 1 for scalar)
Return value and its interpretation heavily depend on the blob type
- Returns
The total number of elements
-
inline virtual size_t byteSize() const¶
Returns the size of the current Blob in bytes.
- Returns
Blob’s size in bytes
-
virtual size_t element_size() const = 0¶
Provides the number of bytes per element.
- Deprecated:
Cast to MemoryBlob and use its API instead. Blob class can represent compound blob, which do not refer to the only solid memory.
The overall Blob capacity is size() * element_size(). Abstract method.
- Returns
Returns the number of bytes per element
-
virtual void allocate() noexcept = 0¶
Allocates memory to store the data.
Abstract method.
-
virtual bool deallocate() noexcept = 0¶
Releases previously allocated data.
Abstract method.
- Returns
True
if deallocation happens successfully,false
otherwise.
-
virtual void setShape(const SizeVector &dims)¶
Set new shape for blob, deallocate/allocate if new total size is bigger than previous one.
- Parameters
dims – new shape
-
virtual Blob::Ptr createROI(const ROI &roi) const¶
Creates a blob describing given ROI object based on the current blob with memory sharing.
Note: default implementation throws “not implemented” exception.
-
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>