MCPcopy Create free account
hub / github.com/NVIDIA/DALI / __next__

Method __next__

dali/test/python/test_external_source_impl.py:128–148  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

126 return TestIterator(self.n, self.batch_size, self.dims, self.as_tensor)
127
128 def __next__(self):
129 random_seed(12345 * self.i + 4321)
130
131 def generate(dim):
132 if self.as_tensor:
133 shape = random_int(1, 10, [dim]).tolist()
134 return random_array([self.batch_size] + shape)
135 else:
136 return [
137 random_array(random_int(1, 10, [dim]).tolist()) for _ in range(self.batch_size)
138 ]
139
140 if self.i < self.n:
141 self.i += 1
142 if isinstance(self.dims, (list, tuple)):
143 return [generate(d) for d in self.dims]
144 else:
145 return generate(self.dims)
146 else:
147 self.i = 0
148 raise StopIteration
149
150 next = __next__
151

Callers

nothing calls this directly

Calls 3

random_seedFunction · 0.70
generateFunction · 0.50
appendMethod · 0.45

Tested by

no test coverage detected