core.backends¶
A CasADi function as plain Python: source for numpy or PyTorch, generated from its graph.
The models of the library are CasADi functions. source writes one as a straight-line Python
function over numpy arrays or PyTorch tensors, one statement per operation of its expression
graph, and translate runs that source. The text imports numpy (or torch) and nothing else, so
a model can leave CasADi behind: a controller on a machine without it, a network that is trained
through a model. The operations are the same ones in the same order, so the values agree with
CasADi to rounding error, and PyTorch differentiates the model like any other function.
Module Attributes
|
Operations of one argument, by CasADi's name, and the numpy name of the function. |
|
Operations of two arguments (and the few others), as the expression that computes them. |
|
the helpers that give arguments and results their CasADi shapes. |
Functions
|
Where each nonzero of |
|
The function as a graph of scalar operations (a CasADi |
|
The functions of a model, by name, as callables of |
|
A float as Python source, exactly. |
|
Python source of |
|
|
|
Comma-separated |