-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for diff of ref return types in rev mode
- Loading branch information
1 parent
049d9db
commit e2b5e5f
Showing
19 changed files
with
717 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
1.2~dev | ||
1.3~dev |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
channels: | ||
- conda-forge | ||
dependencies: | ||
- clad=1.0 | ||
- clad=0.9 | ||
- xeus-cling |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ enum class DiffMode { | |
reverse, | ||
hessian, | ||
jacobian, | ||
reverse_mode_forward_pass, | ||
error_estimation | ||
}; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#ifndef CLAD_TRANSFORM_SOURCE_FN_VISITOR_H | ||
#define CLAD_TRANSFORM_SOURCE_FN_VISITOR_H | ||
|
||
#include "clad/Differentiator/ParseDiffArgsTypes.h" | ||
#include "clad/Differentiator/ReverseModeVisitor.h" | ||
|
||
#include "clang/AST/StmtVisitor.h" | ||
#include "clang/Sema/Sema.h" | ||
|
||
#include "llvm/ADT/SmallVector.h" | ||
|
||
namespace clad { | ||
class ReverseModeForwPassVisitor : public ReverseModeVisitor { | ||
private: | ||
Stmts m_Globals; | ||
|
||
llvm::SmallVector<clang::QualType, 8> | ||
ComputeParamTypes(const DiffParams& diffParams); | ||
clang::QualType ComputeReturnType(); | ||
llvm::SmallVector<clang::ParmVarDecl*, 8> BuildParams(DiffParams& diffParams); | ||
clang::QualType GetParameterDerivativeType(clang::QualType yType, | ||
clang::QualType xType); | ||
|
||
public: | ||
ReverseModeForwPassVisitor(DerivativeBuilder& builder); | ||
DerivativeAndOverload Derive(const clang::FunctionDecl* FD, | ||
const DiffRequest& request); | ||
|
||
StmtDiff ProcessSingleStmt(const clang::Stmt* S); | ||
|
||
StmtDiff VisitStmt(const clang::Stmt* S) override; | ||
StmtDiff VisitCompoundStmt(const clang::CompoundStmt* CS) override; | ||
StmtDiff VisitDeclRefExpr(const clang::DeclRefExpr* DRE) override; | ||
StmtDiff VisitReturnStmt(const clang::ReturnStmt* RS) override; | ||
}; | ||
} // namespace clad | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.