pyqit.set_backend#

pyqit.set_backend(backend: str)[source]#

Set the quantum computing backend for the current context.

Parameters:

backend ({"pennylane", "torch"}) – Backend every object built afterwards will cache in __init__.

Raises:
  • ValueError – If backend is not a supported name.

  • ImportError – If backend is "torch" and torch is not installed. Checked here because this is where the choice is made: every torch import downstream is reached only through the backend being set, so without this the failure surfaces later and unrecognisably.