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

Function numpy_reader_roi_pipe

dali/test/python/reader/test_numpy.py:508–560  ·  view source on GitHub ↗
(
    file_root,
    device="cpu",
    file_filter="*.npy",
    roi_start=None,
    rel_roi_start=None,
    roi_end=None,
    rel_roi_end=None,
    roi_shape=None,
    rel_roi_shape=None,
    roi_axes=None,
    default_axes=[],
    out_of_bounds_policy=None,
    fill_value=None,
)

Source from the content-addressed store, hash-verified

506
507@pipeline_def(device_id=0, num_threads=8)
508def numpy_reader_roi_pipe(
509 file_root,
510 device="cpu",
511 file_filter="*.npy",
512 roi_start=None,
513 rel_roi_start=None,
514 roi_end=None,
515 rel_roi_end=None,
516 roi_shape=None,
517 rel_roi_shape=None,
518 roi_axes=None,
519 default_axes=[],
520 out_of_bounds_policy=None,
521 fill_value=None,
522):
523 data = fn.readers.numpy(
524 device=device,
525 file_root=file_root,
526 file_filter=file_filter,
527 shard_id=0,
528 num_shards=1,
529 cache_header_information=False,
530 )
531 roi_data = fn.readers.numpy(
532 device=device,
533 file_root=file_root,
534 file_filter=file_filter,
535 roi_start=roi_start,
536 rel_roi_start=rel_roi_start,
537 roi_end=roi_end,
538 rel_roi_end=rel_roi_end,
539 roi_shape=roi_shape,
540 rel_roi_shape=rel_roi_shape,
541 roi_axes=roi_axes,
542 out_of_bounds_policy=out_of_bounds_policy,
543 fill_value=fill_value,
544 shard_id=0,
545 num_shards=1,
546 cache_header_information=False,
547 )
548 sliced_data = fn.slice(
549 data,
550 start=roi_start,
551 rel_start=rel_roi_start,
552 end=roi_end,
553 rel_end=rel_roi_end,
554 shape=roi_shape,
555 rel_shape=rel_roi_shape,
556 axes=roi_axes or default_axes, # Slice has different default (axis_names="WH")
557 out_of_bounds_policy=out_of_bounds_policy,
558 fill_values=fill_value,
559 )
560 return roi_data, sliced_data
561
562
563def _testimpl_numpy_reader_roi(

Callers 1

Calls 1

sliceMethod · 0.45

Tested by

no test coverage detected