(
self,
dims,
epoch_size,
dtype,
exception_class=StopIteration,
random_data=False,
random_shape=False,
)
| 27 | """Callable to generate specified data samples""" |
| 28 | |
| 29 | def __init__( |
| 30 | self, |
| 31 | dims, |
| 32 | epoch_size, |
| 33 | dtype, |
| 34 | exception_class=StopIteration, |
| 35 | random_data=False, |
| 36 | random_shape=False, |
| 37 | ): |
| 38 | self.dims = dims |
| 39 | self.epoch_size = epoch_size |
| 40 | self.dtype = dtype |
| 41 | self.exception_class = exception_class |
| 42 | self.ds = {} |
| 43 | self.random_data = random_data |
| 44 | self.random_shape = random_shape |
| 45 | self.data_iterator = None |
| 46 | self.iterator_data_samples = [] |
| 47 | if random_data and not random_shape: |
| 48 | self.data_iterator = iter(RandomDataIterator(1, shape=dims, dtype=dtype)) |
| 49 | if random_data and random_shape: |
| 50 | self.data_iterator = iter(RandomlyShapedDataIterator(1, max_shape=dims, dtype=dtype)) |
| 51 | if not random_data and random_shape: |
| 52 | raise ValueError("If random_shape is required the random_data is required to be True.") |
| 53 | |
| 54 | def __call__(self, sample_info): |
| 55 | if sample_info.idx_in_epoch >= self.epoch_size: |
nothing calls this directly
no test coverage detected