class InferenceEngine::BatchedBlob

Overview

This class represents a blob that contains other blobs - one per batch. More…

#include <ie_compound_blob.h>

class BatchedBlob: public InferenceEngine::CompoundBlob
{
public:
    // typedefs

    typedef std::shared_ptr<BatchedBlob> Ptr;
    typedef std::shared_ptr<const BatchedBlob> CPtr;

    // construction

    BatchedBlob(const std::vector<Blob::Ptr>& blobs);
    BatchedBlob(std::vector<Blob::Ptr>&& blobs);
};

Inherited Members

public:
    // typedefs

    typedef std::shared_ptr<Blob> Ptr;
    typedef std::shared_ptr<const Blob> CPtr;
    typedef std::shared_ptr<CompoundBlob> Ptr;
    typedef std::shared_ptr<const CompoundBlob> CPtr;

    // methods

    static Ptr CreateFromData(const DataPtr& data);

    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();

    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;

    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();

    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;

    virtual const TensorDesc& getTensorDesc() const;
    virtual TensorDesc& getTensorDesc();
    virtual size_t size() const;
    virtual size_t byteSize() const;
    virtual size_t element_size() const = 0;
    virtual void allocate() = 0;
    virtual bool deallocate() = 0;
    void setShape(const SizeVector& dims);
    virtual Blob::Ptr createROI(const ROI& roi) const;

    virtual Blob::Ptr createROI(
        const std::vector<std::size_t>& begin,
        const std::vector<std::size_t>& end
        ) const;

    virtual size_t byteSize() const;
    virtual size_t element_size() const;
    virtual void allocate();
    virtual bool deallocate();
    virtual size_t size() const;
    virtual Blob::Ptr getBlob(size_t i) const;
    virtual Blob::Ptr createROI(const ROI& roi) const;

Detailed Documentation

This class represents a blob that contains other blobs - one per batch.

Plugin which supports BatchedBlob input should report BATCHED_BLOB in the OPTIMIZATION_CAPABILITIES metric.

Typedefs

typedef std::shared_ptr<BatchedBlob> Ptr

A smart pointer to the BatchedBlob object.

typedef std::shared_ptr<const BatchedBlob> CPtr

A smart pointer to the const BatchedBlob object.

Construction

BatchedBlob(const std::vector<Blob::Ptr>& blobs)

Constructs a batched blob from a vector of blobs.

All passed blobs should meet following requirements:

  • all blobs have equal tensor descriptors,

  • blobs layouts should be one of: NCHW, NHWC, NCDHW, NDHWC, NC, CN, C, CHW, HWC

  • batch dimensions should be equal to 1 or not defined (C, CHW, HWC). Resulting blob’s tensor descriptor is constructed using tensor descriptors of passed blobs by setting batch dimension to blobs.size()

Parameters:

blobs

A vector of blobs that is copied to this object

BatchedBlob(std::vector<Blob::Ptr>&& blobs)

Constructs a batched blob from a vector of blobs.

All passed blobs should meet following requirements:

  • all blobs have equal tensor descriptors,

  • blobs layouts should be one of: NCHW, NHWC, NCDHW, NDHWC, NC, CN, C, CHW, HWC

  • batch dimensions should be equal to 1 or not defined (C, CHW, HWC). Resulting blob’s tensor descriptor is constructed using tensor descriptors of passed blobs by setting batch dimension to blobs.size()

Parameters:

blobs

A vector of blobs that is moved to this object