此页面由 AI 自动翻译。查看英文原版

本页目录

  • 创建 NNData
  • 参考

NNData

此消息承载张量及其数据。NeuralNetwork 节点输出 NNData。

创建 NNData

您也可以在主机上创建此消息(示例在此)或在 Script 节点(Script NNData 示例)上创建,用数据填充张量, 然后将消息发送到 NeuralNetwork 节点的 input

参考

class

dai::NNData

#include NNData.hpp
variable
std::vector< TensorInfo > tensors
variable
unsigned int batchSize
variable
std::optional< ImgTransformation > transformation
function
NNData()
Construct NNData message.
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
function
void serialize(std::vector< std::uint8_t > & metadata, DatatypeEnum & datatype)
inline function
DatatypeEnum getDatatype()
function
DEPTHAI_SERIALIZE(NNData, Buffer::sequenceNum, Buffer::ts, Buffer::tsDevice, tensors, batchSize, transformation)

需要帮助?

请前往 Discussion Forum 获取技术支持或提出您可能有的任何其他问题。