吕洞宾属什么生肖

class paddle.io. Dataset [source]
百度 比如发生在2013年中海地产收购中建地产、绿地收购盛高置地等并购行为,对于中海、绿地等企业销售业绩超过千亿起到快速提升的作用;此外,今年融创收购绿城股权的行为也或将助力未来1-2年以孙宏斌为主导的房企联合体加入千亿军团。

An abstract class to encapsulate methods and behaviors of datasets.

All datasets in map-style(dataset samples can be get by a given key) should be a subclass of paddle.io.Dataset. All subclasses should implement following methods:

__getitem__: get sample from dataset with a given index. This method is required by reading dataset sample in paddle.io.DataLoader.

__len__: return dataset sample number. This method is required by some implements of paddle.io.BatchSampler

see paddle.io.DataLoader.

Examples

>>> import numpy as np
>>> from paddle.io import Dataset

>>> # define a random dataset
>>> class RandomDataset(Dataset):  # type: ignore[type-arg]
...     def __init__(self, num_samples):
...         self.num_samples = num_samples
...
...     def __getitem__(self, idx):
...         image = np.random.random([784]).astype('float32')
...         label = np.random.randint(0, 9, (1, )).astype('int64')
...         return image, label
...
...     def __len__(self):
...         return self.num_samples
...
>>> dataset = RandomDataset(10)
>>> for i in range(len(dataset)):
...     image, label = dataset[i]
...     # do something