fix: change the order or the inheritance to impose the correct __mro__
This commit is contained in:
@@ -20,10 +20,16 @@ class QibotnBackend(ABC):
|
|||||||
def set_precision(self, precision):
|
def set_precision(self, precision):
|
||||||
if precision != self.precision:
|
if precision != self.precision:
|
||||||
super().set_precision(precision)
|
super().set_precision(precision)
|
||||||
|
self._setup_backend_specifics()
|
||||||
|
|
||||||
def set_device(self, device):
|
def set_device(self, device):
|
||||||
self.device = device
|
self.device = device
|
||||||
|
self._setup_backend_specifics()
|
||||||
|
|
||||||
def configure_tn_simulation(self, **config):
|
def configure_tn_simulation(self, **config):
|
||||||
"""Configure the TN simulation that will be performed."""
|
"""Configure the TN simulation that will be performed."""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def _setup_backend_specifics(self):
|
||||||
|
"""Configure the backend specific according to the used package."""
|
||||||
|
pass
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ from qibotn.backends.abstract import QibotnBackend
|
|||||||
CUDA_TYPES = {}
|
CUDA_TYPES = {}
|
||||||
|
|
||||||
|
|
||||||
class CuTensorNet(NumpyBackend, QibotnBackend): # pragma: no cover
|
class CuTensorNet(QibotnBackend, NumpyBackend): # pragma: no cover
|
||||||
# CI does not test for GPU
|
# CI does not test for GPU
|
||||||
"""Creates CuQuantum backend for QiboTN."""
|
"""Creates CuQuantum backend for QiboTN."""
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ from qibotn.result import TensorNetworkResult
|
|||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class QMatchaTeaBackend(NumpyBackend, QibotnBackend):
|
class QMatchaTeaBackend(QibotnBackend, NumpyBackend):
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
@@ -25,9 +25,7 @@ class QMatchaTeaBackend(NumpyBackend, QibotnBackend):
|
|||||||
|
|
||||||
# Set default configurations
|
# Set default configurations
|
||||||
self.configure_tn_simulation()
|
self.configure_tn_simulation()
|
||||||
# TODO: update this function whenever ``set_device`` and ``set_precision``
|
self._setup_backend_specifics()
|
||||||
# are set (?)
|
|
||||||
self._setup_qmatchatea_backend()
|
|
||||||
|
|
||||||
def configure_tn_simulation(
|
def configure_tn_simulation(
|
||||||
self,
|
self,
|
||||||
@@ -52,7 +50,7 @@ class QMatchaTeaBackend(NumpyBackend, QibotnBackend):
|
|||||||
)
|
)
|
||||||
self.ansatz = ansatz
|
self.ansatz = ansatz
|
||||||
|
|
||||||
def _setup_qmatchatea_backend(self):
|
def _setup_backend_specifics(self):
|
||||||
"""Configure qmatchatea QCBackend object."""
|
"""Configure qmatchatea QCBackend object."""
|
||||||
|
|
||||||
qmatchatea_device = (
|
qmatchatea_device = (
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ from qibo.result import QuantumState
|
|||||||
from qibotn.backends.abstract import QibotnBackend
|
from qibotn.backends.abstract import QibotnBackend
|
||||||
|
|
||||||
|
|
||||||
class QuimbBackend(NumpyBackend, QibotnBackend):
|
class QuimbBackend(QibotnBackend, NumpyBackend):
|
||||||
|
|
||||||
def __init__(self, runcard):
|
def __init__(self, runcard):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
|
|||||||
Reference in New Issue
Block a user