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

Function run_numpy

dali/test/python/operator_2/test_reduce.py:175–192  ·  view source on GitHub ↗
(reduce_fn, batch_fn, keep_dims, axes, output_type, ddof=None)

Source from the content-addressed store, hash-verified

173
174
175def run_numpy(reduce_fn, batch_fn, keep_dims, axes, output_type, ddof=None):
176 result = []
177 args = {"keepdims": keep_dims, "axis": axes}
178 if output_type is not None:
179 args["dtype"] = output_type
180
181 if ddof is not None:
182 args["ddof"] = ddof
183
184 for _ in range(batch_fn.num_iter()):
185 batch = batch_fn()
186 sample_result = []
187 for sample in batch:
188 sample_reduced = reduce_fn(sample, **args)
189 sample_result.append(sample_reduced)
190
191 result.append(sample_result)
192 return result
193
194
195def compare(dali_res, np_res):

Callers 2

run_reduceFunction · 0.85

Calls 2

num_iterMethod · 0.80
appendMethod · 0.45

Tested by

no test coverage detected