Merge pull request #2460 from mozilla/fix-evaluate-py

Avoid using references to the same object in sparse_tuple_to_text
This commit is contained in:
Reuben Morais 2019-10-24 16:14:16 +00:00 committed by GitHub
commit 1d86469b00
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -34,7 +34,7 @@ def sparse_tensor_value_to_texts(value, alphabet):
def sparse_tuple_to_texts(sp_tuple, alphabet):
indices = sp_tuple[0]
values = sp_tuple[1]
results = [[]] * sp_tuple[2][0]
results = [[] for _ in range(sp_tuple[2][0])]
for i, index in enumerate(indices):
results[index[0]].append(values[i])
# List of strings