Blob creation and memory utilities

Overview

An extension for public Blob API allowing to create blobs in uniform manner. More…

// global functions

void InferenceEngine::blob_copy(Blob::Ptr src, Blob::Ptr dst);
InferenceEngine::Blob::Ptr make_blob_with_precision(const InferenceEngine::TensorDesc& desc);

InferenceEngine::Blob::Ptr make_blob_with_precision(
    const InferenceEngine::TensorDesc& desc,
    void \* ptr
    );

InferenceEngine::Blob::Ptr make_blob_with_precision(
    const InferenceEngine::TensorDesc& desc,
    const std::shared_ptr<InferenceEngine::IAllocator>& alloc
    );

InferenceEngine::Blob::Ptr make_plain_blob(
    InferenceEngine::Precision prec,
    const InferenceEngine::SizeVector dims
    );

template <class... Args>
InferenceEngine::Blob::Ptr make_blob_with_precision(
    InferenceEngine::Precision precision,
    Args&&... args
    );

template <typename T>
void CopyVectorToBlob(
    const InferenceEngine::Blob::Ptr outputBlob,
    const std::vector<T>& inputVector
    );

int ie_memcpy(void \* dest, size_t destsz, void const \* src, size_t count);

Detailed Documentation

An extension for public Blob API allowing to create blobs in uniform manner.

Global Functions

void InferenceEngine::blob_copy(Blob::Ptr src, Blob::Ptr dst)

Copies data with taking into account layout and precision params.

Parameters:

src

The source Blob::Ptr

dst

The destination Blob::Ptr

InferenceEngine::Blob::Ptr make_blob_with_precision(const InferenceEngine::TensorDesc& desc)

Creates Blob::Ptr with precision.

Parameters:

desc

The TensorDesc object

Returns:

A Blob::Ptr pointer

InferenceEngine::Blob::Ptr make_blob_with_precision(
    const InferenceEngine::TensorDesc& desc,
    void \* ptr
    )

Makes a blob with precision.

Parameters:

desc

The TensorDesc object

ptr

The pointer to a raw memory

Returns:

A Blob::Ptr pointer

InferenceEngine::Blob::Ptr make_blob_with_precision(
    const InferenceEngine::TensorDesc& desc,
    const std::shared_ptr<InferenceEngine::IAllocator>& alloc
    )

Makes a blob with precision.

Parameters:

desc

The description

alloc

The IAllocator object

Returns:

A Blob::Ptr pointer

Creates a plain Blob::Ptr.

Parameters:

prec

The Precision value

dims

The dims

Returns:

A Blob::Ptr pointer

template <class... Args>
InferenceEngine::Blob::Ptr make_blob_with_precision(
    InferenceEngine::Precision precision,
    Args&&... args
    )

Creates Blob::Ptr with precision.

Parameters:

precision

The precision

args

The arguments

Args

Variadic template arguments

Returns:

A Blob::Ptr pointer

template <typename T>
void CopyVectorToBlob(
    const InferenceEngine::Blob::Ptr outputBlob,
    const std::vector<T>& inputVector
    )

Copy data from std::vector to Blob.

Parameters:

T

type of data in std::vector

outputBlob

An output blob to copy to

inputVector

An input std::vector to copy from

int ie_memcpy(void \* dest, size_t destsz, void const \* src, size_t count)

Copies bytes between buffers with security enhancements Copies count bytes from src to dest. If the source and destination overlap, the behavior is undefined.

Parameters:

dest

A Pointer to the object to copy to

destsz

A max number of bytes to modify in the destination (typically the size of the destination object)

src

A pointer to the object to copy from

count

A number of bytes to copy

Returns:

zero on success and non-zero value on error.