backend#
- diffeqzoo.backend = <diffeqzoo.backend object>[source]#
Backend implementation of NumPy-like functions via either numpy or jax.
>>> from diffeqzoo import backend # one-stop-shop for numpy, scipy, etc.
>>> # backend.numpy >>> backend.select("jax") >>> backend.numpy.asarray(2.) DeviceArray(2., dtype=float32, weak_type=True)
>>> # Change backend; backend.select("numpy") is not allowed anymore! >>> backend.change_to("numpy") >>> backend.numpy.asarray(2.) array(2.)
To learn about its properties and methods, run
help(diffeqzoo.backend).Note
If you want to change the backend, use
backend.change_to(choice)()instead ofbackend.select(). The reason for this distinction is that we want to reduce the number of accidental backend-changes. Ideally, you select the backend once, and only once.