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

Function run_reduce

dali/test/python/operator_2/test_reduce.py:227–249  ·  view source on GitHub ↗
(keep_dims, reduction_name, batch_gen, input_type, output_type=None, layout=None)

Source from the content-addressed store, hash-verified

225
226
227def run_reduce(keep_dims, reduction_name, batch_gen, input_type, output_type=None, layout=None):
228 batch_fn = batch_gen(input_type)
229 dali_reduce_fn, numpy_reduce_fn = reduce_fns[reduction_name]
230
231 for axes in batch_fn.valid_axes():
232 dali_res_cpu, dali_res_gpu = run_dali(
233 dali_reduce_fn,
234 batch_fn,
235 keep_dims=keep_dims,
236 axes=axes,
237 output_type=output_type,
238 layout=layout,
239 )
240
241 batch_fn.reset()
242
243 np_res = run_numpy(
244 numpy_reduce_fn, batch_fn, keep_dims=keep_dims, axes=axes, output_type=output_type
245 )
246
247 for iteration in range(batch_fn.num_iter()):
248 compare(dali_res_cpu[iteration], np_res[iteration])
249 compare(dali_res_gpu[iteration], np_res[iteration])
250
251
252def test_reduce():

Callers

nothing calls this directly

Calls 7

run_daliFunction · 0.85
run_numpyFunction · 0.85
num_iterMethod · 0.80
batch_genFunction · 0.70
compareFunction · 0.70
valid_axesMethod · 0.45
resetMethod · 0.45

Tested by

no test coverage detected