Sleipnir C++ API
Loading...
Searching...
No Matches
sleipnir::detail::ExpressionGraph Class Reference

#include <sleipnir/autodiff/ExpressionGraph.hpp>

Public Member Functions

 ExpressionGraph (Variable &root)
 
void Update ()
 
VariableMatrix GenerateGradientTree (const VariableMatrix &wrt) const
 
void ComputeAdjoints (function_ref< void(int row, double adjoint)> func)
 

Detailed Description

This class is an adaptor type that performs value updates of an expression's computational graph in a way that skips duplicates.

Constructor & Destructor Documentation

◆ ExpressionGraph()

sleipnir::detail::ExpressionGraph::ExpressionGraph ( Variable root)
inlineexplicit

Generates the deduplicated computational graph for the given expression.

Parameters
rootThe root node of the expression.

Member Function Documentation

◆ ComputeAdjoints()

void sleipnir::detail::ExpressionGraph::ComputeAdjoints ( function_ref< void(int row, double adjoint)>  func)
inline

Updates the adjoints in the expression graph, effectively computing the gradient.

Parameters
funcA function that takes two arguments: an int for the gradient row, and a double for the adjoint (gradient value).

◆ GenerateGradientTree()

VariableMatrix sleipnir::detail::ExpressionGraph::GenerateGradientTree ( const VariableMatrix wrt) const
inline

Returns the variable's gradient tree.

Parameters
wrtVariables with respect to which to compute the gradient.

◆ Update()

void sleipnir::detail::ExpressionGraph::Update ( )
inline

Update the values of all nodes in this computational tree based on the values of their dependent nodes.


The documentation for this class was generated from the following file: