Skip to content

Commit

Permalink
centering export fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Guillaume Lample committed Apr 26, 2018
1 parent 0546ef8 commit a620cc8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,8 +415,8 @@ def normalize_embeddings(emb, types, mean=None):
continue
if t == 'center':
if mean is None:
mean = emb.mean(0, keepdim=True).expand_as(emb)
emb.sub_(mean)
mean = emb.mean(0, keepdim=True)
emb.sub_(mean.expand_as(emb))
elif t == 'renorm':
emb.div_(emb.norm(2, 1, keepdim=True).expand_as(emb))
else:
Expand Down

0 comments on commit a620cc8

Please sign in to comment.