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

fix exhausted reversed_topo #4

Open
wants to merge 1 commit into
base: mb-full-interpreted-mnist
Choose a base branch
from
Open
Changes from all commits
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
3 changes: 1 addition & 2 deletions mnist.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ def stable_softmax(x):
softmax_output = stable_softmax(output)
loss = -sum(exp*(act+0.0001).log() for exp, act in zip(expected_onehot, softmax_output))
topo = loss.topo()
reverse_topo = reversed(topo)
params = model.parameters()
non_params = set(topo)-set(params)

Expand Down Expand Up @@ -132,7 +131,7 @@ def run():
for p in non_params:
p.grad = 0.
loss.grad = 1
for node in reverse_topo:
for node in reversed(topo):
node._backward()
batch_loss += loss.data
epoch_loss += loss.data
Expand Down