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

Function extract_data

dali/test/python/operator_1/test_arithmetic_ops.py:473–491  ·  view source on GitHub ↗

Extract output for given sample_id from the pipeline Expand the data based on the kinds parameter and optionally cast it into target type as numpy does types promotions a bit differently.

(pipe_out, sample_id, kinds, target_type)

Source from the content-addressed store, hash-verified

471
472
473def extract_data(pipe_out, sample_id, kinds, target_type):
474 """
475 Extract output for given sample_id from the pipeline
476 Expand the data based on the kinds parameter and optionally cast it into target type
477 as numpy does types promotions a bit differently.
478 """
479 arity = len(kinds)
480 inputs = []
481 for i in range(arity):
482 dali_in = np.array(pipe_out[i][sample_id].as_cpu())
483 numpy_in = get_numpy_input(
484 dali_in,
485 kinds[i],
486 dali_in.dtype.type,
487 target_type if target_type is not None else dali_in.dtype.type,
488 )
489 inputs.append(numpy_in)
490 out = np.array(pipe_out[arity][sample_id].as_cpu())
491 return tuple(inputs) + (out,)
492
493
494def check_unary_op(kind, type, op, shape, _):

Callers 6

check_arithm_opFunction · 0.70
check_ternary_opFunction · 0.70
check_comparsion_opFunction · 0.70
check_arithm_divFunction · 0.70
check_arithm_modFunction · 0.70

Calls 2

get_numpy_inputFunction · 0.85
appendMethod · 0.45

Tested by

no test coverage detected