| 143 | |
| 144 | |
| 145 | def 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 | |
| 161 | def _test_rrc( |