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

Function generator

dali/test/python/operator_2/test_random_resized_crop.py:145–158  ·  view source on GitHub ↗
(batch_size, max_frames, channel_dim, type)

Source from the content-addressed store, hash-verified

143
144
145def generator(batch_size, max_frames, channel_dim, type):
146 type = test_utils.dali_type_to_np(type)
147 assert max_frames is not None or channel_dim != 1
148
149 def generate():
150 batch = []
151 for _ in range(batch_size):
152 frames = None if max_frames is None else np.random.randint(1, max_frames + 1)
153 sz = np.random.randint(100, 2000 / (max_frames or 1))
154 w, h = np.random.randint(sz, 2 * sz, [2])
155 batch.append(generate_data(frames, w, h, channel_dim, type))
156 return batch
157
158 return generate
159
160
161def _test_rrc(

Callers 2

_test_rrcFunction · 0.70
gen_batchFunction · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected