未验证 提交 d7fcd54d 编写于 作者: J JesseyXujin 提交者: GitHub

Adapte python3.7,delete catch StopIteration exception (#3287)

上级 82c84b0f
# originally based on https://github.com/tensorflow/models/tree/master/lm_1b # originally based on https://github.com/tensorflow/models/tree/master/lm_1b
from __future__ import generators
import glob import glob
import random import random
...@@ -290,7 +291,7 @@ def _get_batch(generator, batch_size, num_steps, max_word_length): ...@@ -290,7 +291,7 @@ def _get_batch(generator, batch_size, num_steps, max_word_length):
if cur_stream[i] is None or len(cur_stream[i][0]) <= 1: if cur_stream[i] is None or len(cur_stream[i][0]) <= 1:
try: try:
cur_stream[i] = list(next(generator)) cur_stream[i] = list(next(generator))
except StopIteration: except:
# No more data, exhaust current streams and quit # No more data, exhaust current streams and quit
no_more_data = True no_more_data = True
break break
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册