Skip to content

Commit 726567a

Browse files
authored
Fix loss summation (#16)
The loss summation relies on data being 1-d. Once Tensor and Variable are merged the loss.data will be 0-d.
1 parent febf63f commit 726567a

File tree

1 file changed

+1
-1
lines changed
  • scripts/mini_sequence_labeler

1 file changed

+1
-1
lines changed

scripts/mini_sequence_labeler/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ def test_wsj():
134134
# print('output=%s, truth=%s' % (output, ex.labels))
135135

136136
loss.backward()
137-
total_loss += loss.data.numpy()[0]
137+
total_loss += float(loss)
138138
optimizer.step()
139139
print(total_loss)
140140

0 commit comments

Comments
 (0)