Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add graph documentations #788

Merged
merged 20 commits into from
Feb 28, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
mainly add API docs for expression_graph.h
  • Loading branch information
qianqianzhu committed Jan 20, 2021
commit c0e9f99ed2ae03dc1a212f95817ff11494750eb6
7 changes: 6 additions & 1 deletion src/graph/expression_graph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Expr ExpressionGraph::add(Expr node) {
} else {
node->setId(count_++);

// record in foward graph
// record in forward graph
nodesForward_.push_back(node);

// record in backward graph if training, and keep track of roots
Expand Down Expand Up @@ -143,6 +143,11 @@ void ExpressionGraph::forward(std::list<Expr>& forwardTape, bool finalPass) {
if(inferenceOnly_)
v->children().clear();

// If checkpointing is disabled, keep the memory for forward signals for all nodes.
// If checkpointing is enabled:
// (a) In the forward pass before the backward pass, free the memory for the nodes in the subtape to save memory.
// (b) In the forward calls during the backward pass, keep the memory in the current subtape to accelerate
// gradient computation.
if(checkpointing_ && !finalPass) {
auto subtape = v->getSubtape();
if(subtape) {
Expand Down
Loading