#include <derivative.h>
|
| | LazyPartialDerivative () |
| |
| | LazyPartialDerivative (const SymbolTableData &symbolTable, const Expr &mathExpr, const ID &rootStmtID, const std::optional< InvertFromStore > &invertFromStore=std::nullopt) |
| |
| void | merge (const LazyPartialDerivative &other) |
| | += another partial derivative
|
| |
| const Expr & | mathExpr () const |
| |
| bool | usingStore () |
| | True if using y for y = f(x)'s derivative.
|
| |
| const std::unordered_set< std::string > & | reads () |
| |
| Expr | replaceExpr (const std::unordered_map< ID, std::string > &intermediatesMap, const std::unordered_map< StmtOrExprID, Expr > &versions, const Expr &expr) |
| |
| Expr | genReplaced (const std::unordered_map< ID, std::string > &intermediatesMap, const std::unordered_map< StmtOrExprID, Expr > &versions) |
| |
Lazy partial derivative dy/dx_i
◆ LazyPartialDerivative() [1/2]
| freetensor::Derivative::LazyPartialDerivative::LazyPartialDerivative |
( |
| ) |
|
|
inline |
◆ LazyPartialDerivative() [2/2]
| freetensor::Derivative::LazyPartialDerivative::LazyPartialDerivative |
( |
const SymbolTableData & |
symbolTable, |
|
|
const Expr & |
mathExpr, |
|
|
const ID & |
rootStmtID, |
|
|
const std::optional< InvertFromStore > & |
invertFromStore = std::nullopt |
|
) |
| |
|
inline |
◆ genReplaced()
| Expr freetensor::Derivative::LazyPartialDerivative::genReplaced |
( |
const std::unordered_map< ID, std::string > & |
intermediatesMap, |
|
|
const std::unordered_map< StmtOrExprID, Expr > & |
versions |
|
) |
| |
|
inline |
Generate finaly derivative expression, where all Load loads from actual tape or recomputation
◆ mathExpr()
| const Expr & freetensor::Derivative::LazyPartialDerivative::mathExpr |
( |
| ) |
const |
|
inline |
Raw derivative expression. Loads in the statements loads forward variables named in the original program, not the final backward pass
◆ merge()
+= another partial derivative
◆ reads()
| const std::unordered_set< std::string > & freetensor::Derivative::LazyPartialDerivative::reads |
( |
| ) |
|
All variables needed to compute the derivative, including variables for tensor indexing, NOT including the y in usingStore. Please note that since grad(x) = derivative * grad(y), this function does not include variable used in grad(x) or grad(y)'s indices.
◆ replaceExpr()
| Expr freetensor::Derivative::LazyPartialDerivative::replaceExpr |
( |
const std::unordered_map< ID, std::string > & |
intermediatesMap, |
|
|
const std::unordered_map< StmtOrExprID, Expr > & |
versions, |
|
|
const Expr & |
expr |
|
) |
| |
Replace any expression in the same context with this LazyPartialDerivative to use taped or recomputed variables
◆ usingStore()
| bool freetensor::Derivative::LazyPartialDerivative::usingStore |
( |
| ) |
|
True if using y for y = f(x)'s derivative.
The documentation for this class was generated from the following files: