![]() |
Sleipnir C++ API
|
#include <sleipnir/autodiff/adjoint_expression_graph.hpp>
Public Member Functions | |
AdjointExpressionGraph (const Variable &root) | |
void | update_values () |
VariableMatrix | generate_gradient_tree (const VariableMatrix &wrt) const |
void | append_adjoint_triplets (small_vector< Eigen::Triplet< double > > &triplets, int row, const VariableMatrix &wrt) const |
This class is an adaptor type that performs value updates of an expression's adjoint graph.
|
inlineexplicit |
Generates the adjoint graph for the given expression.
root | The root node of the expression. |
|
inline |
Updates the adjoints in the expression graph (computes the gradient) then appends the adjoints of wrt to the sparse matrix triplets.
triplets | The sparse matrix triplets. |
row | The row of wrt. |
wrt | Vector of variables with respect to which to compute the Jacobian. |
|
inline |
Returns the variable's gradient tree.
This function lazily allocates variables, so elements of the returned VariableMatrix will be empty if the corresponding element of wrt had no adjoint. Ensure Variable::expr isn't nullptr before calling member functions.
wrt | Variables with respect to which to compute the gradient. |
|
inline |
Update the values of all nodes in this adjoint graph based on the values of their dependent nodes.