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

simplify back propagation (remove unnecessary sequence traversal) #34

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tf318
Copy link

@tf318 tf318 commented Apr 8, 2023

The original recursive back propagation algorithm performs breadth-first visiting of Values in the graph, simply to add them to a linear sequence. The sequence is then reversed and iterated over to invoke the _backward() function in each Value.

It is possible to invoke the _backward() function in a single pass during the breadth-first visiting of Values, without creating an interim linear sequence. This PR simplifies the algorithm accordingly.

@conscell
Copy link

@tf318 This implementation fails tests:
FAILED test_engine.py::test_sanity_check - assert 128.0 == 46.0
FAILED test_engine.py::test_more_ops - assert 15.166180758017475 < 1e-06

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants