# input

Python API: `luxonis_ml.nn_archive.config_building_blocks.base_models.input`

## Classes

### Input

Model input stream definition.

#### Methods

##### infer_layout

```python
def infer_layout(data: dict[str, Any]) -> dict[str, Any]:
```

Infer the layout when a shape is provided without one.

> **Examples**
> ```pycon
>>> Input.infer_layout({"shape": [1, 3, 224, 224]})["layout"]
'NCHW'
>>> Input.infer_layout({"shape": [1, 3, 16, 16, 2]})
{'shape': [1, 3, 16, 16, 2], 'layout': 'NCDEF'}
>>> "layout" in Input.infer_layout({"shape": [1] * 30})
False
```

Parameters

 * `data` (`dict[str, Any]`): Raw input model data.

Returns

 * `dict[str, Any]`: Raw model data with `layout` added when inference succeeds.

##### validate_layout

```python
def validate_layout(self) -> Self:
```

Validate that the layout is compatible with the input shape.

The layout must be a one-to-one description of the shape, so |layout| = |shape|. When `N` is present it denotes batch size and must be first. Image inputs must include a channel dimension `C`.

Returns

 * `Self`: The validated input model.

Raises

 * `ValueError`: If the layout contains duplicate letters, its length does not match the shape length, `N` is present but not first, or image input has no `C` dimension.

#### Attributes

##### dtype

Data type of the input data, such as `"float32"`.

##### input_type

Expected kind of input data, such as `"image"`.

##### layout

Letter code for interpreting tensor dimensions, such as `"NCHW"`.

##### name

Name of the input layer.

##### preprocessing

Preprocessing applied to the input data.

##### shape

Input tensor shape.

### PreprocessingBlock

Preprocessing operations applied to model input data.

#### Attributes

##### dai_type

Optional DepthAI input type used to configure pipeline input handling.

##### interleaved_to_planar

Optional legacy layout conversion flag.

> **Deprecated**
> Deprecated since version 0.5.0:use `dai_type` instead.

##### mean

Optional mean values in channel order. The order should match the preprocessing used during training.

##### reverse_channels

Optional legacy channel-order flag.

> **Deprecated**
> Deprecated since version 0.5.0:use `dai_type` instead.

##### scale

Optional standardization values in channel order. The order should match the preprocessing used during training.
