BackendRegistry: Singleton Backend Registry, managing all available backends.

BackendRegistryR Documentation

Singleton Backend Registry, managing all available backends.

Description

Contains global backend pool, ensuring backends are only loaded if actually required.

Methods

Public methods


Method get_backend()

detect the return relevant backend from the input

Usage
BackendRegistry$get_backend(tensor)
Arguments
tensor

any supported tensor-like class

Returns

A singleton instance of a EinopsBackend() object


Method get_backend_from_type()

Get a backend instance for a specific tensor type. If the backend is not loaded, it will be instantiated.

Usage
BackendRegistry$get_backend_from_type(tensor_class)
Arguments
tensor_class

A string representing the tensor type.

Returns

An instance of the backend class for the specified tensor type.


Method register_backend()

Register a new backend singleton

Usage
BackendRegistry$register_backend(
  tensor_type,
  backend_class_thunk,
  dependencies = character(0),
  testing = FALSE,
  aliases = character(0)
)
Arguments
tensor_type

a string with the tensor type the backend supports

backend_class_thunk

a thunk()'ed EinopsBackend subclass generator

dependencies

a character vector of required package names

testing

logical flag indicating if this is a testing-only backend

aliases

a character vector of aliases for the tensor type

Returns

this object


Method unregister_backend()

Unregister a backend for a specific tensor type.

Usage
BackendRegistry$unregister_backend(tensor_type)
Arguments
tensor_type

a string with the tensor type

Returns

this object


Method add_backend_alias()

Add an alias for a backend type.

Usage
BackendRegistry$add_backend_alias(alias, tensor_type)
Arguments
alias

a string with the alias name

tensor_type

a string with the canonical tensor type

Returns

this object


Method clear_testing_backends()

Clear all testing-only backends.

Usage
BackendRegistry$clear_testing_backends()
Returns

this object


Method get_supported_types()

Get a list of all registered backend types.

Usage
BackendRegistry$get_supported_types()
Returns

A character vector of backend types.


Method get_dependencies()

given a tensor type, return the required packages

Usage
BackendRegistry$get_dependencies(tensor_type)
Arguments
tensor_type

a string with the tensor type

Returns

a character vector with required packages. Length 0 if no packages are required.


Method is_loadable()

Check if a tensor type is truly loadable, i.e., if it is registered and has no missing dependencies.

Usage
BackendRegistry$is_loadable(tensor_type)
Arguments
tensor_type

a string with the tensor type

Returns

TRUE if the tensor type is loadable, FALSE otherwise.


einops documentation built on Sept. 9, 2025, 5:29 p.m.