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

Function test_reduce_invalid_axes

dali/test/python/operator_2/test_reduce.py:286–298  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

284
285
286def test_reduce_invalid_axes():
287 class Batch3DInvalidAxes(Batch3D):
288 def valid_axes(self): # Invalid axes
289 return [-100, (100, 0)]
290
291 batch_fn = Batch3DInvalidAxes(np.uint8)
292 dali_reduce_fn, numpy_reduce_fn = reduce_fns["sum"]
293
294 for axes in batch_fn.valid_axes():
295 with assert_raises(IndexError, glob="Axis index out of range"):
296 dali_res_cpu, dali_res_gpu = run_dali(
297 dali_reduce_fn, batch_fn, keep_dims=False, axes=axes, output_type=np.uint8
298 )
299
300
301def test_reduce_with_promotion():

Callers

nothing calls this directly

Calls 4

valid_axesMethod · 0.95
assert_raisesFunction · 0.90
Batch3DInvalidAxesClass · 0.85
run_daliFunction · 0.85

Tested by

no test coverage detected