diff --git a/src/qibo/models/encodings.py b/src/qibo/models/encodings.py index 5ba3216bf1..fac9ccf8f9 100644 --- a/src/qibo/models/encodings.py +++ b/src/qibo/models/encodings.py @@ -45,6 +45,9 @@ def __init__( basis_element = list(map(int, basis_element)) + if nqubits is None: + nqubits = len(basis_element) + super().__init__(nqubits, **kwargs) for qubit, elem in enumerate(basis_element): if elem == 1: