Skip to content

Commit 0a93cfd

Browse files
authored
added missing zero_grad
1 parent ab5b8b6 commit 0a93cfd

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

TCN/copy_memory/copymem_test.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,8 @@ def train(ep):
106106

107107
x = train_x[start_ind:end_ind]
108108
y = train_y[start_ind:end_ind]
109-
109+
110+
optimizer.zero_grad()
110111
out = model(x.unsqueeze(1).contiguous())
111112
loss = criterion(out.view(-1, n_classes), y.view(-1))
112113
pred = out.view(-1, n_classes).data.max(1, keepdim=True)[1]

0 commit comments

Comments
 (0)