Sleipnir Python API
|
Public Member Functions | |
None | __init__ (self, Variable variable, Variable wrt) |
None | __init__ (self, Variable variable, VariableMatrix wrt) |
VariableMatrix | get (self) |
scipy.sparse.csc_matrix[float] | value (self) |
This class calculates the gradient of a a variable with respect to a vector of variables. The gradient is only recomputed if the variable expression is quadratic or higher order.
Constructs a Gradient object. Parameter ``variable``: Variable of which to compute the gradient. Parameter ``wrt``: Variable with respect to which to compute the gradient.
None jormungandr.autodiff.Gradient.__init__ | ( | self, | |
Variable | variable, | ||
VariableMatrix | wrt | ||
) |
Constructs a Gradient object. Parameter ``variable``: Variable of which to compute the gradient. Parameter ``wrt``: Vector of variables with respect to which to compute the gradient.
VariableMatrix jormungandr.autodiff.Gradient.get | ( | self | ) |
Returns the gradient as a VariableMatrix. This is useful when constructing optimization problems with derivatives in them.
scipy.sparse.csc_matrix[float] jormungandr.autodiff.Gradient.value | ( | self | ) |
Evaluates the gradient at wrt's value.