Skip to content
This repository has been archived by the owner on Mar 3, 2024. It is now read-only.

Commit

Permalink
Fix scope issue in python 2
Browse files Browse the repository at this point in the history
  • Loading branch information
CyberZHG committed Jun 3, 2019
1 parent 76eec0b commit ce2b7e7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion keras_transformer/transformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ def decode(model,
if top_k == 1:
last_token = predicts[i][-1].argmax(axis=-1)
else:
probs = [(prob, i) for i, prob in enumerate(predicts[i][-1])]
probs = [(prob, j) for j, prob in enumerate(predicts[i][-1])]
probs.sort(reverse=True)
probs = probs[:top_k]
indices, probs = list(map(lambda x: x[1], probs)), list(map(lambda x: x[0], probs))
Expand Down

0 comments on commit ce2b7e7

Please sign in to comment.