NNData
This message carries tensors and its data. NeuralNetwork node outputs NNData.Creating NNData
You can also create this message on the host (example here) or Script node (Script NNData example), populate the tensor with the data, and send the message to theinput
of the NeuralNetwork node.Reference
class
dai::NNData
variable
std::vector< TensorInfo > tensors
variable
unsigned int batchSize
variable
std::optional< ImgTransformation > transformation
function
NNData()
function
NNData(size_t size)
function
~NNData()
function
std::vector< std::string > getAllLayerNames()
Returns
Names of all layers added
function
std::vector< TensorInfo > getAllLayers()
Returns
All layers and their information
function
std::optional< TensorInfo > getTensorInfo(const std::string & name)
Retrieve tensor information
Parameters
- name: Name of the tensor
Returns
Tensor information
function
bool getLayer(const std::string & name, TensorInfo & tensor)
Retrieve layers tensor information
Parameters
- name: Name of the layer
- tensor: Outputs tensor information of that layer
Returns
True if layer exists, false otherwise
function
bool hasLayer(const std::string & name)
Checks if given layer exists
Parameters
- name: Name of the layer
Returns
True if layer exists, false otherwise
function
bool getLayerDatatype(const std::string & name, TensorInfo::DataType & datatype)
Retrieve datatype of a layers tensor
Parameters
- name: Name of the layer
- datatype: Datatype of layers tensor
Returns
True if layer exists, false otherwise
function
TensorInfo::DataType getTensorDatatype(const std::string & name)
Get the datatype of a given tensor
Returns
TensorInfo::DataType tensor datatype
function
TensorInfo::DataType getFirstTensorDatatype()
Get the datatype of the first tensor
Returns
TensorInfo::DataType tensor datatype
function
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
inline function
void serialize(std::vector< std::uint8_t > & metadata, DatatypeEnum & datatype)
function
DEPTHAI_SERIALIZE(NNData, Buffer::sequenceNum, Buffer::ts, Buffer::tsDevice, tensors, batchSize, transformation)
Need assistance?
Head over to Discussion Forum for technical support or any other questions you might have.