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

Function check_unary_op

dali/test/python/operator_1/test_arithmetic_ops.py:494–506  ·  view source on GitHub ↗
(kind, type, op, shape, _)

Source from the content-addressed store, hash-verified

492
493
494def check_unary_op(kind, type, op, shape, _):
495 # Regular arithmetic ops that can be validated as straight numpy
496 iterator = iter(ExternalInputIterator(batch_size, shape, type, kind))
497 pipe = ExprOpPipeline(
498 kind, type, iterator, op, batch_size=batch_size, num_threads=2, device_id=0
499 )
500 pipe_out = pipe.run()
501 for sample in range(batch_size):
502 in_np, out = extract_un_data(pipe_out, sample, kind, type)
503 if "f" in np.dtype(type).kind:
504 np.testing.assert_allclose(out, op(in_np), rtol=1e-07 if type != np.float16 else 0.005)
505 else:
506 assert np.array_equal(out, op(in_np))
507
508
509def test_unary_arithmetic_ops():

Callers 2

test_bitnot_selectedFunction · 0.85
slow_test_bitnotFunction · 0.85

Calls 6

ExprOpPipelineClass · 0.85
extract_un_dataFunction · 0.85
opFunction · 0.50
runMethod · 0.45
dtypeMethod · 0.45

Tested by

no test coverage detected