summaryrefslogtreecommitdiff
path: root/experiments/ep_synthetic.py
diff options
context:
space:
mode:
Diffstat (limited to 'experiments/ep_synthetic.py')
-rw-r--r--experiments/ep_synthetic.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/experiments/ep_synthetic.py b/experiments/ep_synthetic.py
index bb7f4af..7daecde 100644
--- a/experiments/ep_synthetic.py
+++ b/experiments/ep_synthetic.py
@@ -95,7 +95,7 @@ def compute_diagnostics(model, teacher, dev, d, C, L, beta=0.5, T_nudge=20, alph
hs=[x.detach().requires_grad_(True)]
for b in model.blocks:hs.append(hs[-1]+b(hs[-1]))
lo=model.out_head(hs[-1]);loss=F.cross_entropy(lo,y)
- gs=torch.autograd.grad(loss,hs);bp={l:gs[l].detach() for l in range(L)}
+ gs=torch.autograd.grad(loss,hs);bp={l:gs[l].detach() for l in range(L+1)}
# EP credit
with torch.no_grad():_,hf=model(x,return_hidden=True)
h_free=[h.detach().clone() for h in hf]