synthetic_digits.py 文件源码

python
阅读 36 收藏 0 点赞 0 评论 0

项目:master-thesis 作者: AndreasMadsen 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号