Skip to content

Commit 0ec5b79

Browse files
committed
Fix RuntimeError: a leaf Variable that requires grad has been used in an in-place operation.
1 parent 7d19122 commit 0ec5b79

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

main.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ def main():
134134
emb[vocab.getIndex(word)] = glove_emb[glove_vocab.getIndex(word)]
135135
torch.save(emb, emb_file)
136136
# plug these into embedding matrix inside model
137-
model.emb.weight.copy_(emb)
137+
model.emb.weight.data.copy_(emb)
138138

139139
model.to(device), criterion.to(device)
140140
if args.optim == 'adam':

0 commit comments

Comments
 (0)