# types

Python API: `hubai_sdk.utils.types`

Enums used by model metadata and conversion configuration.

Service APIs generally accept these enums directly. Their `value` is the spelling sent to HubAI, while `name` is used by a few
list filters. Use [Target](https://docs.luxonis.com/cloud/hubai/model-registry/hubai-sdk/hubai-sdk-api-reference/utils/types.md)
to choose conversion hardware and
[ModelType](https://docs.luxonis.com/cloud/hubai/model-registry/hubai-sdk/hubai-sdk-api-reference/utils/types.md) to describe an
existing artifact.

## Classes

### DataType

Tensor element type shared by supported model formats.

#### Methods

##### as_nn_archive_dtype

```python
def as_nn_archive_dtype(self) -> str:
```

Convert this data type to the NN Archive dtype spelling.

##### as_numpy_dtype

```python
def as_numpy_dtype(self) -> np.dtype:
```

Convert this data type to the corresponding NumPy dtype.

##### as_openvino_dtype

```python
def as_openvino_dtype(self) -> str:
```

Convert this data type to the corresponding OpenVINO dtype.

##### as_snpe_dtype

```python
def as_snpe_dtype(self) -> str:
```

Convert this data type to the corresponding SNPE dtype.

##### from_dlc_dtype

```python
def from_dlc_dtype(dtype: str) -> DataType:
```

Create a [DataType](https://docs.luxonis.com/cloud/hubai/model-registry/hubai-sdk/hubai-sdk-api-reference/utils/types.md) from an
SNPE DLC dtype name.

##### from_ir_ie_dtype

```python
def from_ir_ie_dtype(dtype: str) -> DataType:
```

Create a [DataType](https://docs.luxonis.com/cloud/hubai/model-registry/hubai-sdk/hubai-sdk-api-reference/utils/types.md) from an
OpenVINO IR dtype string.

##### from_ir_runtime_dtype

```python
def from_ir_runtime_dtype(dtype: str) -> DataType:
```

Create a [DataType](https://docs.luxonis.com/cloud/hubai/model-registry/hubai-sdk/hubai-sdk-api-reference/utils/types.md) from an
OpenVINO runtime dtype string.

##### from_numpy_dtype

```python
def from_numpy_dtype(dtype: np.dtype) -> DataType:
```

Create a [DataType](https://docs.luxonis.com/cloud/hubai/model-registry/hubai-sdk/hubai-sdk-api-reference/utils/types.md) from a
NumPy dtype.

##### from_onnx_dtype

```python
def from_onnx_dtype(dtype: int) -> DataType:
```

Create a [DataType](https://docs.luxonis.com/cloud/hubai/model-registry/hubai-sdk/hubai-sdk-api-reference/utils/types.md) from an
ONNX tensor dtype value.

##### from_tensorflow_dtype

```python
def from_tensorflow_dtype(dtype: int) -> DataType:
```

Create a [DataType](https://docs.luxonis.com/cloud/hubai/model-registry/hubai-sdk/hubai-sdk-api-reference/utils/types.md) from a
TFLite tensor dtype value.

#### Attributes

##### BOOLEAN

##### FLOAT16

##### FLOAT32

##### FLOAT64

##### FXP16

##### FXP32

##### FXP64

##### FXP8

##### INT16

##### INT32

##### INT4

##### INT64

##### INT8

##### STRING

##### UFXP16

##### UFXP32

##### UFXP64

##### UFXP8

##### UINT16

##### UINT32

##### UINT64

##### UINT8

### Encoding

Channel ordering for image tensors and preprocessing.

#### Attributes

##### BGR

##### GRAY

##### NONE

##### RGB

### InputFileType

Supported source model container or framework format.

#### Methods

##### from_path

```python
def from_path(path: str | Path) -> InputFileType:
```

Infer the input file type from a model path suffix.

#### Attributes

##### DLC

##### HAR

##### IR

##### ONNX

##### PYTORCH

##### TFLITE

### ModelType

Artifact type stored by a HubAI model instance.

#### Methods

##### from_suffix

```python
def from_suffix(suffix: str) -> ModelType:
```

Infer a model type from a file suffix.

#### Attributes

##### HAILO

##### IR

##### ONNX

##### PYTORCH

##### RVC2

##### RVC3

##### RVC4

##### TFLITE

### PotDevice

Target device used by OpenVINO Post-training Optimization Tool.

#### Attributes

##### ANY

##### VPU

### ResizeMethod

Strategy for adapting image dimensions to a model input.

#### Attributes

##### CROP

##### PAD

##### RESIZE

### Target

Hardware family accepted by hosted conversion.

#### Attributes

##### HAILO

##### RVC2

##### RVC3

##### RVC4
