Crash when checkpointing an empty call graph
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 3.4k
- Forks
- 702
- PR merge metrics
- No merged PRs in 30d
Description
Running with master (d65bd5e) on Python 3.5.2 on a CPU, this crashes:
import dynet as dy
model = dy.Model()
x = model.add_parameters((10,10))
dy.cg_checkpoint()
However, this succeeds:
import dynet as dy
model = dy.Model()
x = model.add_parameters((10,10))
y = x*x
dy.cg_checkpoint()
I think it might have something to do with _get_checkpoint calling mark, which has this line, and the last part evaluates to -1 when there are no nodes:
cg->incremental_forward({cg, (VariableIndex)(cg->nodes.size() - 1)});
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Run the two Python reproductions to confirm that dy.cg_checkpoint() crashes only with an empty call graph. Then inspect _get_checkpoint and mark in dynet/devices.cc, especially the incremental_forward call linked in the issue. Done means checkpointing the empty graph succeeds without regressing the nonempty-graph case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, python
- Domain
- machine-learning
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100