sciai.common.DatasetGenerator

View Source On Gitee
class sciai.common.DatasetGenerator(*data)[source]

Common data generator.

Parameters

*data (any) – Data to be iterated over.

Raises

TypeError – If the input type is incorrect.

Supported Platforms:

GPU CPU Ascend

Examples

>>> import numpy as np
>>> from sciai.common import DatasetGenerator
>>> data = np.array(range(128)).reshape(-1, 2)
>>> dg = DatasetGenerator(data)
>>> print(len(dg))
64