# NNData

This message carries tensors and its data.
[NeuralNetwork](https://docs.luxonis.com/software/depthai-components/nodes/neural_network.md) node outputs NNData.

## Creating NNData

You can also create this message on the host ([example
here](https://github.com/luxonis/oak-examples/blob/cd4a1e2be64a7c0319870cf80b4be3bd0561e9a0/gen2-efficientnet-classification/main.py#L125-L127))
or [Script](https://docs.luxonis.com/software/depthai-components/nodes/script.md) node ([Script NNData
example](https://docs.luxonis.com/software/depthai/examples/script_nndata_example.md)), populate the tensor with the data, and
send the message to the input of the [NeuralNetwork](https://docs.luxonis.com/software/depthai-components/nodes/neural_network.md)
node.

## Reference

### depthai.NNData(depthai.Buffer)

Kind: Class

NNData message. Carries tensors and their metadata

#### __init__(self)

Kind: Method

Construct NNData message.

#### getAllLayerNames(self) -> list[str]: list[str]

Kind: Method

Returns:
Names of all layers added

#### getAllLayers(self) -> list[TensorInfo]: list[TensorInfo]

Kind: Method

Returns:
All layers and their information

#### getFirstLayerFp16(self) -> list[float]: list[float]

Kind: Method

Convenience function to retrieve float values from first layers FP16 tensor

Returns:
Float data

#### getFirstLayerInt32(self) -> list[int]: list[int]

Kind: Method

Convenience function to retrieve INT32 values from first layers tensor

Returns:
INT32 data

#### getFirstLayerUInt8(self) -> list[int]: list[int]

Kind: Method

Convenience function to retrieve U8 data from first layer

Returns:
U8 binary data

#### getLayer(self, name: str, tensor: TensorInfo) -> bool: bool

Kind: Method

Retrieve layers tensor information

Parameter ``name``:
Name of the layer

Parameter ``tensor``:
Outputs tensor information of that layer

Returns:
True if layer exists, false otherwise

#### getLayerDatatype(self, name: str, datatype: TensorInfo.DataType) -> bool: bool

Kind: Method

Retrieve datatype of a layers tensor

Parameter ``name``:
Name of the layer

Parameter ``datatype``:
Datatype of layers tensor

Returns:
True if layer exists, false otherwise

#### getLayerFp16(self, name: str) -> list[float]: list[float]

Kind: Method

Convenience function to retrieve float values from layers FP16 tensor

Parameter ``name``:
Name of the layer

Returns:
Float data

#### getLayerInt32(self, name: str) -> list[int]: list[int]

Kind: Method

Convenience function to retrieve INT32 values from layers tensor

Parameter ``name``:
Name of the layer

Returns:
INT32 data

#### getLayerUInt8(self, name: str) -> list[int]: list[int]

Kind: Method

Convenience function to retrieve U8 data from layer

Parameter ``name``:
Name of the layer

Returns:
U8 binary data

#### getSequenceNum(self) -> int: int

Kind: Method

Retrieves sequence number

#### getTimestamp(self) -> datetime.timedelta: datetime.timedelta

Kind: Method

Retrieves timestamp related to dai::Clock::now()

#### getTimestampDevice(self) -> datetime.timedelta: datetime.timedelta

Kind: Method

Retrieves timestamp directly captured from device's monotonic clock, not
synchronized to host time. Used mostly for debugging

#### hasLayer(self, name: str) -> bool: bool

Kind: Method

Checks if given layer exists

Parameter ``name``:
Name of the layer

Returns:
True if layer exists, false otherwise

#### setLayer()

Kind: Method

#### setSequenceNum(self, arg0: typing.SupportsInt) -> NNData: NNData

Kind: Method

Retrieves image sequence number

#### setTimestamp(self, arg0: datetime.timedelta) -> NNData: NNData

Kind: Method

Sets image timestamp related to dai::Clock::now()

#### setTimestampDevice(self, arg0: datetime.timedelta) -> NNData: NNData

Kind: Method

Sets image timestamp related to dai::Clock::now()

### Need assistance?

Head over to [Discussion Forum](https://discuss.luxonis.com/) for technical support or any other questions you might have.
