---
title: CompressedTensorModel (latest version)
description: API reference for ibm_quantum_schemas.common.CompressedTensorModel in the latest version of qiskit-ibm-runtime
source: https://eu-de.quantum.cloud.ibm.com/docs/en/api/qiskit-ibm-runtime/ibm-quantum-schemas-common-compressed-tensor-model
---

# CompressedTensorModel

*pydantic model* `CompressedTensorModel`

[GitHub](https://github.com/Qiskit/ibm-quantum-schemas/tree/0.10.20260723/ibm_quantum_schemas/common/tensor.py#L134-L203)

Bases: [`TensorModel`](/docs/api/qiskit-ibm-runtime/ibm-quantum-schemas-common-tensor-model "ibm_quantum_schemas.common.tensor.TensorModel")

Model of compressed tensor data.

### data

*field*

Type: `str`

Base-64-encoded data in litte endian format.

Bool arrays are bitpacked, other types are IEEE753. Everything is little-endian. Tensors are C-ordering.

**Validated by**

- `check_sizes`

### dtype

*field*

Type: `Literal`\[`'f16'`, `'f32'`, `'f64'`, `'bool'`, `'i8'`, `'i16'`, `'i32'`, `'i64'`, `'u8'`, `'u16'`, `'u32'`, `'u64'`, `'c64'`, `'c128'`]

The data type of the tensor.

**Validated by**

- `check_sizes`

### shape

*field*

Type: `list`\[`int`]

The shape of the tensor.

**Validated by**

- `check_sizes`

### check\_sizes

*validator* `check_sizes`

[GitHub](https://github.com/Qiskit/ibm-quantum-schemas/tree/0.10.20260723/ibm_quantum_schemas/common/tensor.py#L191-L203)

Cross-validate that all sizes are consistent.

### from\_numpy

*classmethod* `from_numpy(array)`

[GitHub](https://github.com/Qiskit/ibm-quantum-schemas/tree/0.10.20260723/ibm_quantum_schemas/common/tensor.py#L158-L173)

Instantiate from a NumPy array.

**Parameters**

**array** ([*ndarray*](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray))

### to\_numpy

`to_numpy()`

[GitHub](https://github.com/Qiskit/ibm-quantum-schemas/tree/0.10.20260723/ibm_quantum_schemas/common/tensor.py#L175-L189)

Convert to a NumPy Array.

**Return type**

[*ndarray*](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray)
