Class NNData

Inheritance Relationships

Base Type

Class Documentation

class NNData : public dai::Buffer

NNData message. Carries tensors and their metadata

Public Functions

NNData() = default

Construct NNData message.

NNData(size_t size)
virtual ~NNData()
std::vector<std::string> getAllLayerNames() const
Returns:

Names of all layers added

std::vector<TensorInfo> getAllLayers() const
Returns:

All layers and their information

std::optional<TensorInfo> getTensorInfo(const std::string &name) const

Retrieve tensor information

Parameters:

name – Name of the tensor

Returns:

Tensor information

bool getLayer(const std::string &name, TensorInfo &tensor) const

Retrieve layers tensor information

Parameters:
  • name – Name of the layer

  • tensor[out] Outputs tensor information of that layer

Returns:

True if layer exists, false otherwise

bool hasLayer(const std::string &name) const

Checks if given layer exists

Parameters:

name – Name of the layer

Returns:

True if layer exists, false otherwise

bool getLayerDatatype(const std::string &name, TensorInfo::DataType &datatype) const

Retrieve datatype of a layers tensor

Parameters:
  • name – Name of the layer

  • datatype[out] Datatype of layers tensor

Returns:

True if layer exists, false otherwise

TensorInfo::DataType getTensorDatatype(const std::string &name)

Get the datatype of a given tensor

Returns:

TensorInfo::DataType tensor datatype

TensorInfo::DataType getFirstTensorDatatype()

Get the datatype of the first tensor

Returns:

TensorInfo::DataType tensor datatype

span<std::uint8_t> emplaceTensor(TensorInfo &tensor)

Emplace a tensor This function allocates memory for the tensor and return over the said memory. It is up to the caller to fill the memory out with meaningful data.

Returns:

Span over the allocated memory

virtual void serialize(std::vector<std::uint8_t> &metadata, DatatypeEnum &datatype) const override
DEPTHAI_SERIALIZE(NNData, Buffer::sequenceNum, Buffer::ts, Buffer::tsDevice, tensors, batchSize, transformation)

Public Members

std::vector<TensorInfo> tensors
unsigned int batchSize
std::optional<ImgTransformation> transformation