提交 520612bf 编写于 作者: Y Yu Yang

Reverse sort

上级 db8d8890
......@@ -264,7 +264,8 @@ class DataReader(object):
def batch_generator(self):
# global sort or global shuffle
if self._sort_type == SortType.GLOBAL:
infos = sorted(self._sample_infos, key=lambda x: x.max_len)
infos = sorted(
self._sample_infos, key=lambda x: x.max_len, reverse=True)
else:
if self._shuffle:
infos = self._sample_infos
......@@ -278,7 +279,8 @@ class DataReader(object):
self._pool_size] = sorted(
infos[i * self._pool_size:(i + 1) *
self._pool_size],
key=lambda x: x.max_len)
key=lambda x: x.max_len,
reverse=True)
# concat batch
batches = []
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册