qem.backend_utils

Backend detection and configuration utilities.

Functions

auto_configure()

Auto-configure backend if none is set.

backend_specific_config(backend_name)

Apply backend-specific configurations.

configure_backend([backend_name, force])

Configure Keras to use the specified backend.

detect_available_backends()

Detect which Keras backends are available in the current environment.

get_best_backend()

Get the best available backend for the current environment.

setup_test_backend()

Set up the best available backend for testing.

qem.backend_utils.detect_available_backends()[source]

Detect which Keras backends are available in the current environment.

Returns:

list – List of available backend names in order of preference

qem.backend_utils.get_best_backend()[source]

Get the best available backend for the current environment.

Returns:

str – Name of the best available backend

Raises:

RuntimeError – If no backends are available

qem.backend_utils.configure_backend(backend_name=None, force=False)[source]

Configure Keras to use the specified backend.

Parameters:
  • backend_name (str, optional) – Backend to use. If None, auto-detect best.

  • force (bool) – Whether to force reconfiguration even if already set.

Returns:

str – Name of the configured backend

qem.backend_utils.setup_test_backend()[source]

Set up the best available backend for testing.

Returns:

str – Name of the configured backend

qem.backend_utils.backend_specific_config(backend_name)[source]

Apply backend-specific configurations.

Parameters:

backend_name (str) – Name of the backend to configure

qem.backend_utils.auto_configure()[source]

Auto-configure backend if none is set.