ucurv.backend
ucurv.backend
Backend, so use ncp as a stand in for np basically, will either call numpy or cupy behind the scenes, as their methods are mostly interchangeable. Must explicitly specify cupy if want to use, and will only use cupy if GPU is available, or else will throw an error.
_backend can be “auto” (default), “numpy”, or “cupy”.
set_backend(name) must be called before the first use of
ncp().ncp() returns the active array module (numpy or cupy).
Typical use
from ucurv.backend import ncp, set_backend
y = ncp().sin(ncp().pi / 4)
- ucurv.backend.get_module(backend: str = 'numpy')[source]
Returns correct numerical module based on backend string
- Parameters:
backend (
str, optional) – Backend used for dot test computations (numpyorcupy). This parameter will be used to choose how to create the random vectors.- Returns:
mod – Module to be used to process array (
numpyorcupy)- Return type:
func