def _build_dataset(self) -> Iterator[Tuple[str, str]]:
length_type = size_to_unsigned_type(self._max_length)
for _ in range(self._examples):
length = self._random.randint(
self._min_length, self._max_length + 1,
dtype=length_type
)
target = self._random.randint(
0, self._digits,
size=length, dtype=np.int8
)
source = text_map[target]
target_str = ''.join(target.astype(np.str))
source_str = ' '.join(source)
yield (source_str, target_str)
评论列表
文章目录