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

Function get_input_arg_per_frame

dali/test/python/sequences_test_utils.py:327–345  ·  view source on GitHub ↗
(input_data: ArgData, param_cb, rng, check_broadcasting)

Source from the content-addressed store, hash-verified

325
326
327def get_input_arg_per_frame(input_data: ArgData, param_cb, rng, check_broadcasting):
328 frame_idx = input_data.desc.expandable_prefix.find("F")
329 assert frame_idx >= 0
330
331 def arg_for_sample(sample_idx, batch_idx, sample):
332 if check_broadcasting and rng.randint(1, 4) == 1:
333 return np.array([param_cb(SampleDesc(rng, 0, sample_idx, batch_idx, sample))])
334 num_frames = sample.shape[frame_idx]
335 return np.array(
336 [
337 param_cb(SampleDesc(rng, frame_idx, sample_idx, batch_idx, sample))
338 for frame_idx in range(num_frames)
339 ]
340 )
341
342 return [
343 [arg_for_sample(sample_idx, batch_idx, sample) for sample_idx, sample in enumerate(batch)]
344 for batch_idx, batch in enumerate(input_data.data)
345 ]
346
347
348def compute_input_params_data(input_data: ArgData, rng, input_params: List[ArgCb]):

Callers 1

input_param_dataFunction · 0.85

Calls 2

arg_for_sampleFunction · 0.85
findMethod · 0.45

Tested by

no test coverage detected