From 81062cd9e8101faf031958ce2355871532b27618 Mon Sep 17 00:00:00 2001 From: Krzysztof Lecki Date: Tue, 19 Nov 2024 15:14:43 +0100 Subject: [PATCH 1/4] Replace all parameter references from double backticks to single Signed-off-by: Krzysztof Lecki --- dali/operators/audio/nonsilence_op.cc | 8 +- dali/operators/audio/preemphasis_filter_op.cc | 4 +- dali/operators/audio/resample.cc | 24 ++--- dali/operators/bbox/bb_flip.cc | 6 +- dali/operators/bbox/bbox_paste.cc | 4 +- .../decoder/cache/cached_decoder_impl.cc | 4 +- dali/operators/decoder/image_decoder.cc | 44 ++++----- dali/operators/decoder/inflate/inflate.cc | 18 ++-- dali/operators/generic/constant.cc | 14 +-- dali/operators/generic/erase/erase.cc | 30 +++--- dali/operators/generic/expand_dims.cc | 10 +- dali/operators/generic/join.cc | 8 +- dali/operators/generic/lookup_table.cc | 12 +-- dali/operators/generic/one_hot.cc | 14 +-- dali/operators/generic/pad.cc | 14 +-- dali/operators/generic/permute_batch.cc | 4 +- dali/operators/generic/reduce/reduce.cc | 4 +- dali/operators/generic/reshape.cc | 24 ++--- dali/operators/generic/roi_random_crop.cc | 14 +-- .../generic/slice/out_of_bounds_attr.cc | 6 +- dali/operators/generic/slice/slice.cc | 28 +++--- dali/operators/generic/slice/slice_attr.cc | 16 ++-- dali/operators/generic/slice/slice_attr.h | 4 +- dali/operators/generic/squeeze.cc | 8 +- dali/operators/generic/transpose/transpose.cc | 10 +- .../affine_transforms/transform_crop.cc | 6 +- .../affine_transforms/transform_rotation.cc | 4 +- .../affine_transforms/transform_scale.cc | 4 +- .../affine_transforms/transform_shear.cc | 16 ++-- dali/operators/geometry/coord_transform.cc | 4 +- dali/operators/geometry/mt_transform_attr.cc | 18 ++-- dali/operators/image/color/color_twist.cc | 6 +- dali/operators/image/convolution/filter.cc | 2 +- .../image/convolution/gaussian_blur.cc | 4 +- dali/operators/image/convolution/laplacian.cc | 12 +-- dali/operators/image/crop/bbox_crop.cc | 94 +++++++++---------- dali/operators/image/crop/crop_attr.cc | 26 ++--- .../image/crop/crop_mirror_normalize.cc | 4 +- .../jpeg_compression_distortion_op_cpu.cc | 4 +- dali/operators/image/paste/paste.cc | 4 +- .../image/remap/cvcuda/warp_perspective.cc | 2 +- dali/operators/image/remap/jitter.cu | 4 +- dali/operators/image/remap/rotate.cc | 6 +- dali/operators/image/remap/warp_affine.cc | 8 +- .../operators/image/resize/resampling_attr.cc | 4 +- dali/operators/image/resize/resize_attr.cc | 24 ++--- .../image/resize/resize_attr_base.cc | 16 ++-- .../image/resize/resize_crop_mirror.cc | 4 +- .../image/resize/tensor_resize_attr.cc | 16 ++-- dali/operators/imgcodec/decoder_schema.cc | 28 +++--- dali/operators/input/video_input_cpu.cc | 4 +- dali/operators/math/normalize/normalize.cc | 22 ++--- dali/operators/numba_function/numba_func.cc | 8 +- .../python_function/dltensor_function.cc | 4 +- .../python_function/python_function.cc | 2 +- .../operators/random/beta_distribution_cpu.cc | 4 +- dali/operators/random/choice_cpu.cc | 10 +- dali/operators/random/coin_flip_cpu.cc | 10 +- dali/operators/random/noise/shot_noise.cc | 8 +- .../random/normal_distribution_cpu.cc | 8 +- .../random/uniform_distribution_cpu.cc | 28 +++--- dali/operators/reader/coco_reader_op.cc | 24 ++--- dali/operators/reader/file_reader_op.cc | 36 +++---- dali/operators/reader/fits_reader_op.cc | 28 +++--- .../reader/loader/file_label_loader.h | 2 +- dali/operators/reader/loader/loader.cc | 6 +- dali/operators/reader/numpy_reader_op.cc | 30 +++--- dali/operators/reader/sequence_reader_op.cc | 4 +- .../reader/video_reader_decoder_cpu_op.cc | 8 +- dali/operators/reader/video_reader_op.cc | 22 ++--- dali/operators/reader/video_reader_op.h | 4 +- dali/operators/reader/webdataset_reader_op.cc | 8 +- .../segmentation/random_mask_pixel.cc | 12 +-- .../segmentation/random_object_bbox.cc | 24 ++--- dali/operators/segmentation/select_masks.cc | 4 +- dali/operators/sequence/element_extract.cc | 4 +- dali/operators/sequence/per_frame.cc | 4 +- dali/operators/sequence/sequence_rearrange.cc | 4 +- dali/operators/signal/fft/power_spectrum.cc | 4 +- dali/operators/signal/fft/spectrogram.cc | 8 +- dali/operators/ssd/box_encoder.cc | 4 +- dali/operators/util/get_property.cc | 2 +- .../operator/builtin/external_source.cc | 4 +- .../operator/builtin/input_operator.cc | 2 +- dali/pipeline/operator/op_schema.cc | 10 +- .../nvidia/dali/auto_aug/rand_augment.py | 8 +- dali/python/nvidia/dali/external_source.py | 68 +++++++------- dali/python/nvidia/dali/math.py | 52 +++++----- .../nvidia/dali/ops/_operators/compose.py | 4 +- .../dali/ops/_operators/python_function.pyi | 14 +-- dali/python/nvidia/dali/pipeline.py | 24 ++--- .../nvidia/dali/plugin/base_iterator.py | 4 +- dali/python/nvidia/dali/plugin/jax/clu.py | 4 +- .../dali/plugin/jax/fn/_jax_function_impl.py | 20 ++-- .../python/nvidia/dali/plugin/jax/iterator.py | 4 +- dali/python/nvidia/dali/plugin/paddle.py | 8 +- .../nvidia/dali/plugin/pytorch/__init__.py | 12 +-- dali/python/nvidia/dali/plugin/tf.py | 20 ++-- dali/test/python/operator_2/test_squeeze.py | 4 +- 99 files changed, 632 insertions(+), 632 deletions(-) diff --git a/dali/operators/audio/nonsilence_op.cc b/dali/operators/audio/nonsilence_op.cc index d7a922115a5..f3f657039b6 100644 --- a/dali/operators/audio/nonsilence_op.cc +++ b/dali/operators/audio/nonsilence_op.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2020-2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// Copyright (c) 2020-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -22,13 +22,13 @@ DALI_SCHEMA(NonsilentRegion) .DocStr(R"code(Performs leading and trailing silence detection in an audio buffer. The operator returns the beginning and length of the non-silent region by comparing the -short term power calculated for ``window_length`` of the signal with a silence cut-off threshold. +short term power calculated for `window_length` of the signal with a silence cut-off threshold. The signal is considered to be silent when the ``short_term_power_db`` is less than -the ``cutoff_db``. where:: +the `cutoff_db`. where:: short_term_power_db = 10 * log10( short_term_power / reference_power ) -Unless specified otherwise, ``reference_power`` is the maximum power of the signal. +Unless specified otherwise, `reference_power` is the maximum power of the signal. Inputs and outputs: diff --git a/dali/operators/audio/preemphasis_filter_op.cc b/dali/operators/audio/preemphasis_filter_op.cc index 335414a30b1..9f2eb355dbe 100644 --- a/dali/operators/audio/preemphasis_filter_op.cc +++ b/dali/operators/audio/preemphasis_filter_op.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2019-2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// Copyright (c) 2019-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -30,7 +30,7 @@ This filter, in simple form, can be expressed by the formula:: with ``X`` and ``Y`` being the input and output signal, respectively. -The value of ``X_border`` depends on the ``border`` argument:: +The value of ``X_border`` depends on the `border` argument:: X_border = 0 if border_type == 'zero' X_border = X[0] if border_type == 'clamp' diff --git a/dali/operators/audio/resample.cc b/dali/operators/audio/resample.cc index f52220bbfd6..5918d71ddb0 100644 --- a/dali/operators/audio/resample.cc +++ b/dali/operators/audio/resample.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// Copyright (c) 2022-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -26,7 +26,7 @@ DALI_SCHEMA(AudioResample) .DocStr(R"(Resamples an audio signal. The resampling is achieved by applying a sinc filter with Hann window with an extent -controlled by the ``quality`` argument. +controlled by the `quality` argument. The resampling ratio can be specified directly or as a ratio of target to source sampling rate, or calculated from the ratio of the requested output length to the input length. @@ -35,33 +35,33 @@ or calculated from the ratio of the requested output length to the input length. .NumOutput(1) .AddOptionalArg("in_rate", R"(Input sampling rate. -The sampling rate of the input sample. This parameter must be specified together with ``out_rate``. -The value is relative to ``out_rate`` and doesn't need to use any specific unit as long as the +The sampling rate of the input sample. This parameter must be specified together with `out_rate`. +The value is relative to `out_rate` and doesn't need to use any specific unit as long as the units of input and output rates match. -The ``in_rate`` and ``out_rate`` parameters cannot be specified together with ``scale`` or -``out_length``.)", +The `in_rate` and `out_rate` parameters cannot be specified together with `scale` or +`out_length`.)", nullptr, true) .AddOptionalArg("out_rate", R"(Output sampling rate. -The requested output sampling rate. This parameter must be specified together with ``in_rate``. -The value is relative to ``in_rate`` and doesn't need to use any specific unit as long as the +The requested output sampling rate. This parameter must be specified together with `in_rate`. +The value is relative to `in_rate` and doesn't need to use any specific unit as long as the units of input and output rates match. -The ``in_rate`` and ``out_rate`` parameters cannot be specified together with ``scale`` or -``out_length``.)", +The `in_rate` and `out_rate` parameters cannot be specified together with `scale` or +`out_length`.)", nullptr, true) .AddOptionalArg("scale", R"(The scaling factor. The scaling factor is the ratio of the target sampling rate to source sampling rate. For example, a ``scale=2`` will produce an output with twice as many samples as the input. -This parameter cannot be specified together with ``in_rate`` and ``out_rate`` or ``out_length``.)", +This parameter cannot be specified together with `in_rate` and `out_rate` or `out_length`.)", nullptr, true) .AddOptionalArg("out_length", R"(The requested output length, in samples. The scaling factor is the ratio of this output length to the input length. This parameter -cannot be specified together with ``in_rate``, ``out_rate`` or ``scale``.)", +cannot be specified together with `in_rate`, `out_rate` or `scale`.)", nullptr, true) .AddOptionalArg("quality", R"(Resampling quality, where 0 is the lowest, and 100 is the highest. diff --git a/dali/operators/bbox/bb_flip.cc b/dali/operators/bbox/bb_flip.cc index 14c64e37783..78709eda054 100644 --- a/dali/operators/bbox/bb_flip.cc +++ b/dali/operators/bbox/bb_flip.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// Copyright (c) 2017-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -25,12 +25,12 @@ DALI_SCHEMA(BbFlip) .DocStr(R"code(Flips bounding boxes horizontally or vertically (mirror). The bounding box coordinates for the input are in the [x, y, width, height] - ``xywh`` or -[left, top, right, bottom] - ``ltrb`` format. All coordinates are in the image coordinate +[left, top, right, bottom] - `ltrb` format. All coordinates are in the image coordinate system, that is 0.0-1.0)code") .NumInput(1) .NumOutput(1) .AddOptionalArg("ltrb", - R"code(True for ``ltrb`` or False for ``xywh``.)code", + R"code(True for `ltrb` or False for ``xywh``.)code", false, false) .AddOptionalArg("horizontal", R"code(Flip horizontal dimension.)code", diff --git a/dali/operators/bbox/bbox_paste.cc b/dali/operators/bbox/bbox_paste.cc index f94469a5409..f5da637cbec 100644 --- a/dali/operators/bbox/bbox_paste.cc +++ b/dali/operators/bbox/bbox_paste.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// Copyright (c) 2017-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -45,7 +45,7 @@ canvas and ``(1,1)`` aligns it to bottom-right. R"code(Ratio of the canvas size to the input size; the value must be at least 1.)code", DALI_FLOAT, true) .AddOptionalArg("ltrb", - R"code(True for ``ltrb`` or False for ``xywh``.)code", + R"code(True for `ltrb` or False for ``xywh``.)code", false, false) .AddOptionalArg("paste_x", R"code(Horizontal position of the paste in image coordinates (0.0 - 1.0).)code", diff --git a/dali/operators/decoder/cache/cached_decoder_impl.cc b/dali/operators/decoder/cache/cached_decoder_impl.cc index da3811d83d7..8dd0b4c8f1a 100644 --- a/dali/operators/decoder/cache/cached_decoder_impl.cc +++ b/dali/operators/decoder/cache/cached_decoder_impl.cc @@ -98,7 +98,7 @@ DALI_SCHEMA(CachedDecoderAttr) R"code(Applies **only** to the ``mixed`` backend type. Total size of the decoder cache in megabytes. When provided, the decoded images -that are larger than ``cache_threshold`` will be cached in GPU memory. +that are larger than `cache_threshold` will be cached in GPU memory. )code", 0) .AddOptionalArg("cache_threshold", @@ -125,7 +125,7 @@ copied with ``cudaMemcpy``.)code", Here is a list of the available cache types: -* | ``threshold``: caches every image with a size that is larger than ``cache_threshold`` until +* | ``threshold``: caches every image with a size that is larger than `cache_threshold` until | the cache is full. The warm-up time for threshold policy is 1 epoch. diff --git a/dali/operators/decoder/image_decoder.cc b/dali/operators/decoder/image_decoder.cc index 435d2c5aecf..1556d0438c3 100644 --- a/dali/operators/decoder/image_decoder.cc +++ b/dali/operators/decoder/image_decoder.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2019-2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// Copyright (c) 2019-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -50,7 +50,7 @@ reallocated to decode the image. If a value greater than 0 is provided, the operator preallocates one device buffer of the requested size per thread. If the value is correctly selected, no additional allocations will occur during the pipeline execution. One way to find the ideal value is to do a complete -run over the dataset with the ``memory_stats`` argument set to True and then copy the largest +run over the dataset with the `memory_stats` argument set to True and then copy the largest allocation value that was printed in the statistics.)code", 16*1024*1024) .AddOptionalArg("device_memory_padding_jpeg2k", @@ -63,7 +63,7 @@ reallocated to decode the image. If a value greater than 0 is provided, the operator preallocates the necessary number of buffers according to the hint provided. If the value is correctly selected, no additional allocations will occur during the pipeline execution. One way to find the ideal value is to do a complete -run over the dataset with the ``memory_stats`` argument set to True and then copy the largest +run over the dataset with the `memory_stats` argument set to True and then copy the largest allocation value that was printed in the statistics.)code", 0) .AddOptionalArg("host_memory_padding", @@ -76,7 +76,7 @@ to be reallocated to decode the image. If a value greater than 0 is provided, the operator preallocates two (because of double-buffering) host-pinned buffers of the requested size per thread. If selected correctly, no additional allocations will occur during the pipeline execution. One way to find the ideal value is to -do a complete run over the dataset with the ``memory_stats`` argument set to True, and then copy +do a complete run over the dataset with the `memory_stats` argument set to True, and then copy the largest allocation value that is printed in the statistics.)code", 8*1024*1024) // based on ImageNet heuristics (8MB) .AddOptionalArg("host_memory_padding_jpeg2k", @@ -89,7 +89,7 @@ to be reallocated to decode the image. If a value greater than 0 is provided, the operator preallocates the necessary number of buffers according to the hint provided. If the value is correctly selected, no additional allocations will occur during the pipeline execution. One way to find the ideal value is to -do a complete run over the dataset with the ``memory_stats`` argument set to True, and then copy +do a complete run over the dataset with the `memory_stats` argument set to True, and then copy the largest allocation value that is printed in the statistics.)code", 0) .AddOptionalArg("hw_decoder_load", @@ -137,7 +137,7 @@ them at runtime.)code", false) .DeprecateArg("use_chunk_allocator") // deprecated in DALI 1.0 .AddOptionalArg("use_fast_idct", - R"code(Enables fast IDCT in the libjpeg-turbo based CPU decoder, used when ``device`` is set + R"code(Enables fast IDCT in the libjpeg-turbo based CPU decoder, used when `device` is set to "cpu" or when the it is set to "mixed" but the particular image can not be handled by the GPU implementation. @@ -154,8 +154,8 @@ ImageMagick.)code", R"code(Applies **only** to the ``mixed`` backend type. Prints debug information about nvJPEG allocations. The information about the largest -allocation might be useful to determine suitable values for ``device_memory_padding`` and -``host_memory_padding`` for a dataset. +allocation might be useful to determine suitable values for `device_memory_padding` and +`host_memory_padding` for a dataset. .. note:: The statistics are global for the entire process, not per operator instance, and include @@ -210,7 +210,7 @@ Supported formats: JPG, BMP, PNG, TIFF, PNM, PPM, PGM, PBM, JPEG 2000, WebP. .. note:: JPEG 2000 region-of-interest (ROI) decoding is not accelerated on the GPU, and will use a CPU implementation regardless of the selected backend. For a GPU accelerated implementation, - consider using separate ``decoders.image`` and ``crop`` operators. + consider using separate ``decoders.image`` and `crop` operators. .. note:: EXIF orientation metadata is disregarded.)code") @@ -223,7 +223,7 @@ DALI_SCHEMA(decoders__ImageRandomCrop) .DocStr(R"code(Decodes images and randomly crops them. The cropping window's area (relative to the entire image) and aspect ratio can be restricted to -a range of values specified by ``area`` and ``aspect_ratio`` arguments, respectively. +a range of values specified by ``area`` and `aspect_ratio` arguments. respectively. When possible, the operator uses the ROI decoding APIs (for example, *libjpeg-turbo* and *nvJPEG*) to reduce the decoding time and memory usage. When the ROI decoding is not supported for a given @@ -254,23 +254,23 @@ and shape of the slice. Both coordinates and shapes can be provided in absolute The slice arguments can be specified by the following named arguments: -#. ``start``: Slice start coordinates (absolute) -#. ``rel_start``: Slice start coordinates (relative) -#. ``end``: Slice end coordinates (absolute) -#. ``rel_end``: Slice end coordinates (relative) -#. ``shape``: Slice shape (absolute) -#. ``rel_shape``: Slice shape (relative) +#. `start`: Slice start coordinates (absolute) +#. `rel_start`: Slice start coordinates (relative) +#. `end`: Slice end coordinates (absolute) +#. `rel_end`: Slice end coordinates (relative) +#. `shape`: Slice shape (absolute) +#. `rel_shape`: Slice shape (relative) The slice can be configured by providing start and end coordinates or start and shape. -Relative and absolute arguments can be mixed (for example, ``rel_start`` can be used with ``shape``) +Relative and absolute arguments can be mixed (for example, `rel_start` can be used with `shape`) as long as start and shape or end are uniquely defined. -Alternatively, two extra positional inputs can be provided, specifying ``anchor`` and ``shape``. -When using positional inputs, two extra boolean arguments ``normalized_anchor``/``normalized_shape`` +Alternatively, two extra positional inputs can be provided, specifying ``anchor`` and `shape`. +When using positional inputs, two extra boolean arguments `normalized_anchor`/`normalized_shape` can be used to specify the nature of the arguments provided. Using positional inputs for anchor and shape is incompatible with the named arguments specified above. -The slice arguments should provide as many dimensions as specified by the ``axis_names`` or ``axes`` +The slice arguments should provide as many dimensions as specified by the `axis_names` or `axes` arguments. By default, the :meth:`nvidia.dali.fn.decoders.image_slice` operator uses normalized coordinates @@ -302,14 +302,14 @@ point of the slice (x0, x1, x2, …). Integer coordinates are interpreted as absolute coordinates, while float coordinates can be interpreted as absolute or relative coordinates, depending on the value of -``normalized_anchor``.)code") +`normalized_anchor`.)code") .InputDox(2, "shape", "1D TensorList of float or int", R"code(Input that contains normalized or absolute coordinates for the dimensions of the slice (s0, s1, s2, …). Integer coordinates are interpreted as absolute coordinates, while float coordinates can be interpreted as absolute or relative coordinates, depending on the value of -``normalized_shape``.)code"); +`normalized_shape`.)code"); // Deprecated aliases diff --git a/dali/operators/decoder/inflate/inflate.cc b/dali/operators/decoder/inflate/inflate.cc index 2ebb1ab6cfe..0542e5341ef 100644 --- a/dali/operators/decoder/inflate/inflate.cc +++ b/dali/operators/decoder/inflate/inflate.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// Copyright (c) 2022-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -21,7 +21,7 @@ namespace dali { DALI_SCHEMA(experimental__Inflate) .DocStr(R"code(Inflates/decompresses the input using specified decompression algorithm. -The input must be a 1D tensor of bytes (uint8). Passing the ``shape`` and ``dtype`` of the +The input must be a 1D tensor of bytes (uint8). Passing the `shape` and `dtype` of the decompressed samples is required. Each input sample can either be a single compressed chunk or consist of multiple @@ -29,8 +29,8 @@ compressed chunks that have the same shape and type when inflated, so that they be merged into a single tensor where the outermost extent of the tensor corresponds to the number of the chunks. -If the sample is comprised of multiple chunks, the ``chunk_offsets`` or ``chunk_sizes`` -must be specified. In that case, the ``shape`` must describe the shape of a single inflated +If the sample is comprised of multiple chunks, the `chunk_offsets` or `chunk_sizes` +must be specified. In that case, the `shape` must describe the shape of a single inflated (output) chunk. The number of the chunks will automatically be added as the outermost extent to the output tensors. @@ -58,13 +58,13 @@ concatenating compressed frames from the corresponding sequences.:: R"code(A list of offsets within the input sample describing where the consecutive chunks begin. -If the ``chunk_sizes`` is not specified, it is assumed that the chunks are densely packed +If the `chunk_sizes` is not specified, it is assumed that the chunks are densely packed in the input tensor and the last chunk ends with the sample's end.)code", nullptr, true) .AddOptionalArg>(inflate::sizeArgName, R"code(A list of sizes of corresponding input chunks. -If the ``chunk_offsets`` is not specified, it is assumed that the chunks are densely packed +If the `chunk_offsets` is not specified, it is assumed that the chunks are densely packed in the input tensor and the first chunk starts at the beginning of the sample.)code", nullptr, true) .AddOptionalArg(inflate::algArgName, R"code(Algorithm to be used to decode the data. @@ -74,7 +74,7 @@ Currently only ``LZ4`` is supported.)code", .AddOptionalArg(inflate::layoutArgName, R"code(Layout of the output (inflated) chunk. -If the samples consist of multiple chunks, additionally, the ``sequence_axis_name`` extent +If the samples consist of multiple chunks, additionally, the `sequence_axis_name` extent will be added to the beginning of the specified layout.)code", TensorLayout("")) .AddOptionalArg(inflate::sequenceLayoutArgName, R"code(The name for the sequence axis. @@ -82,8 +82,8 @@ will be added to the beginning of the specified layout.)code", If the samples consist of multiple chunks, an extra outer dimension will be added to the output tensor. By default, it is assumed to be video frames, hence the default label 'F' -The value is ignored if the ``layout`` is not specified or the input is not a sequence -( neither ``chunk_offsets`` nor ``chunk_sizes`` is specified). +The value is ignored if the `layout` is not specified or the input is not a sequence +( neither `chunk_offsets` nor `chunk_sizes` is specified). )code", TensorLayout("F")); diff --git a/dali/operators/generic/constant.cc b/dali/operators/generic/constant.cc index ea97a55c7ff..2282a16391f 100644 --- a/dali/operators/generic/constant.cc +++ b/dali/operators/generic/constant.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2020-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// Copyright (c) 2020-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -25,9 +25,9 @@ namespace dali { DALI_SCHEMA(Constant) .DocStr(R"code(Produces a batch of constant tensors. -The floating point input data should be placed in the ``fdata`` argument -and integer data in ``idata``. The data, which can be a flat vector of values or a scalar, -is then reshaped according to the ``shape`` argument. If the data is scalar, it will be broadcast +The floating point input data should be placed in the `fdata` argument +and integer data in `idata`. The data, which can be a flat vector of values or a scalar, +is then reshaped according to the `shape` argument. If the data is scalar, it will be broadcast to fill the entire shape. The operator only performs meaningful work at first invocation; subsequent calls will return @@ -36,7 +36,7 @@ a reference to the same memory. The operator can be automatically instantiated in Python with a call to :func:`types.Constant(value, dtype, shape, layout) `. The value can be a scalar, a tuple, a list, or a numpy array. If not explicitly overridden, -the ``shape`` and ``dtype``, will be taken from the array. +the `shape` and `dtype`, will be taken from the array. .. warning:: 64-bit integer and double precision arrays are not supported and will be silently @@ -51,13 +51,13 @@ the ``shape`` and ``dtype``, will be taken from the array. R"code(Contents of the constant that is produced (for floating point types). .. note:: - ``fdata`` and ``idata`` are mutually exclusive, and one of them is required.)code", + `fdata` and `idata` are mutually exclusive, and one of them is required.)code", std::vector()) .AddOptionalArg("idata", R"code(Contents of the constant that is produced (for integer point types). .. note:: - ``fdata`` and ``idata`` are mutually exclusive, and one of them is required.)code", + `fdata` and `idata` are mutually exclusive, and one of them is required.)code", std::vector()) .AddOptionalTypeArg("dtype", R"code(Output data type. diff --git a/dali/operators/generic/erase/erase.cc b/dali/operators/generic/erase/erase.cc index 1a8b46a6eb6..9d7bc7a2aba 100644 --- a/dali/operators/generic/erase/erase.cc +++ b/dali/operators/generic/erase/erase.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2019-2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// Copyright (c) 2019-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -29,20 +29,20 @@ namespace dali { DALI_SCHEMA(Erase) .DocStr(R"code(Erases one or more regions from the input tensors. -The region is specified by an ``anchor`` (starting point) and a ``shape`` (dimensions). +The region is specified by an `anchor` (starting point) and a `shape` (dimensions). Only the relevant dimensions are specified. Not specified dimensions are treated as if the entire range of the axis was provided. -To specify multiple regions, ``anchor`` and ``shape`` represent multiple points consecutively -(for example, ``anchor`` = (y0, x0, y1, x1, ...) and ``shape`` = (h0, w0, h1, w1, ...)). -The ``anchor`` and ``shape`` arguments are interpreted based on the value of the ``axis_names`` -argument, or, alternatively, the value of the ``axes`` argument. If no ``axis_names`` or -``axes`` arguments are provided, all dimensions except ``C`` (channels) must be specified. +To specify multiple regions, `anchor` and `shape`.represent multiple points consecutively +(for example, `anchor` = (y0, x0, y1, x1, ...) and `shape`.= (h0, w0, h1, w1, ...)). +The `anchor` and `shape`.arguments are interpreted based on the value of the `axis_names` +argument, or, alternatively, the value of the `axes` argument. If no `axis_names` or +`axes` arguments are provided, all dimensions except ``C`` (channels) must be specified. **Example 1:** -``anchor`` = (10, 20), ``shape`` = (190, 200), ``axis_names`` = "HW", ``fill_value`` = 0 +`anchor` = (10, 20), `shape` = (190, 200), `axis_names` = "HW", `fill_value` = 0 -input: ``layout`` = "HWC", ``shape`` = (300, 300, 3) +input: ``layout`` = "HWC", `shape` = (300, 300, 3) The erase region covers the range between 10 and 200 in the vertical dimension (height) and between 20 and 220 in the horizontal dimension (width). The range for the channel @@ -54,9 +54,9 @@ What gives:: **Example 2:** -``anchor`` = (10, 250), ``shape`` = (20, 30), ``axis_names`` = "W", ``fill_value`` = (118, 185, 0) +`anchor` = (10, 250), `shape` = (20, 30), `axis_names` = "W", `fill_value` = (118, 185, 0) -input: ``layout`` = "HWC", ``shape`` = (300, 300, 3) +input: ``layout`` = "HWC", `shape` = (300, 300, 3) Two erase regions are provided, which covers two vertical bands that range from x=(10, 30) and x=(250, 280), respectively. Each pixel in the erased regions is filled with a multi-channel @@ -68,9 +68,9 @@ What gives:: **Example 3:** -``anchor`` = (0.15, 0.15), ``shape`` = (0.3, 0.3), ``axis_names`` = "HW", ``fill_value`` = 100, ``normalized`` = True +`anchor` = (0.15, 0.15), `shape` = (0.3, 0.3), `axis_names` = "HW", `fill_value` = 100, `normalized` = True -input: ``layout`` = "HWC", ``shape`` = (300, 300, 3) +input: ``layout`` = "HWC", `shape` = (300, 300, 3) One erase region with normalized coordinates in the height, and the width dimensions is provided. A fill value is provided for all the channels. The coordinates can be transformed to the absolute by @@ -84,9 +84,9 @@ What gives:: output[y, x, c] = input[y, x, c] **Example 4:** -``anchor`` = (0.15, 0.15), ``shape`` = (20, 30), ``normalized_anchor`` = True, ``normalized_shape`` = False +`anchor` = (0.15, 0.15), `shape` = (20, 30), `normalized_anchor` = True, `normalized_shape` = False -input: ``layout`` = "HWC", ``shape`` = (300, 300, 3) +input: ``layout`` = "HWC", `shape` = (300, 300, 3) One erase region with an anchor is specified in normalized coordinates and the shape in absolute coordinates. Since no axis_names is provided, the anchor and shape must contain all dimensions diff --git a/dali/operators/generic/expand_dims.cc b/dali/operators/generic/expand_dims.cc index d57aecf05a0..cfe68142460 100644 --- a/dali/operators/generic/expand_dims.cc +++ b/dali/operators/generic/expand_dims.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2021-2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// Copyright (c) 2021-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -28,10 +28,10 @@ namespace dali { DALI_SCHEMA(ExpandDims) .DocStr(R"code(Insert new dimension(s) with extent 1 to the data shape. -The new dimensions are inserted at the positions specified by ``axes``. +The new dimensions are inserted at the positions specified by `axes`. -If ``new_axis_names`` is provided, the new dimension names will be inserted in the data layout, -at the positions specified by ``axes``. If ``new_axis_names`` is not provided, the output data +If `new_axis_names` is provided, the new dimension names will be inserted in the data layout, +at the positions specified by `axes`. If `new_axis_names` is not provided, the output data layout will be empty.")code") .NumInput(1) .NumOutput(1) @@ -43,7 +43,7 @@ layout will be empty.")code") DALI_INT_VEC, true) .AddOptionalArg("new_axis_names", R"code(Names of the new dimensions in the data layout. -The length of ``new_axis_names`` must match the length of ``axes``. +The length of `new_axis_names` must match the length of `axes`. If argument isn't be provided, the layout will be cleared.)code", TensorLayout("")); template diff --git a/dali/operators/generic/join.cc b/dali/operators/generic/join.cc index 1fb241e8809..4362b5917b3 100644 --- a/dali/operators/generic/join.cc +++ b/dali/operators/generic/join.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2020-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// Copyright (c) 2020-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -34,7 +34,7 @@ The shapes of the inputs must match in all dimensions except the concatenation a Accepted range is [-ndim, ndim-1]. Negative indices are counted from the back.)code", 0, false) .AddOptionalArg("axis_name", R"(Name of the axis along which the tensors are concatenated. -This argument is mutually exclusive with ``axis``. +This argument is mutually exclusive with `axis`. This argument requires that at least one input has a non-empty layout and that all non-empty input layouts match.)", nullptr, false) .NumInput(1, 999) @@ -47,14 +47,14 @@ The shapes of respective tensors in the inputs must match.)") .AddOptionalArg("axis", R"code(The axis in the output tensor along which the inputs are stacked. The axis is inserted before a corresponding axis in the inputs. A value of 0 indicates that whole -tensors are stacked. Specifying ``axis`` equal to the number of dimensions in the inputs causes +tensors are stacked. Specifying `axis` equal to the number of dimensions in the inputs causes the values from the inputs to be interleaved). Accepted range is [-ndim, ndim]. Negative indices are counted from the back.)code", 0, false) .AddOptionalArg("axis_name", R"(Name of the new axis to be inserted. A one-character string that will denote the new axis in the output layout. The output layout will be -constructed by inserting that character into the input layout at the position indicated by ``axis``. +constructed by inserting that character into the input layout at the position indicated by `axis`. For example, specifying ``axis = 0`` and ``axis_name = "C"`` with input layout "HW" will yield the output layout "CHW")", nullptr, false) .NumInput(1, 999) diff --git a/dali/operators/generic/lookup_table.cc b/dali/operators/generic/lookup_table.cc index 20c4272f7cd..f7f325298c6 100644 --- a/dali/operators/generic/lookup_table.cc +++ b/dali/operators/generic/lookup_table.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2019-2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// Copyright (c) 2019-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -66,9 +66,9 @@ DALI_REGISTER_OPERATOR(LookupTable, LookupTable, CPU); DALI_SCHEMA(LookupTable) .DocStr(R"code(Maps the input to output by using a lookup table that is specified by -``keys`` and ``values``, and a ``default_value`` for unspecified keys. +`keys` and `values`, and a `default_value` for unspecified keys. -For example when ``keys`` and ``values`` are used to define the lookup table in the following way:: +For example when `keys` and `values` are used to define the lookup table in the following way:: keys[] = {0, 2, 3, 4, 5, 3} values[] = {0.2, 0.4, 0.5, 0.6, 0.7, 0.10} @@ -109,13 +109,13 @@ Here is a practical example, considering the table defined above:: .AddOptionalArg("keys", R"code(A list of input values (keys) in the lookup table. -The length of ``keys`` and ``values`` argument must match. The values in ``keys`` should be in the +The length of `keys` and `values` argument must match. The values in `keys` should be in the [0, )code" + std::to_string(LookupTable::kMaxKey) + " ] range.", std::vector{}) .AddOptionalArg("values", - R"code(A list of mapped output ``values`` for each ``keys`` entry. + R"code(A list of mapped output `values` for each `keys` entry. -The length of the ``keys`` and the ``values`` argument must match. +The length of the `keys` and the `values` argument must match. )code", std::vector{}); diff --git a/dali/operators/generic/one_hot.cc b/dali/operators/generic/one_hot.cc index bf1ce3bd0d4..a9af4619acb 100644 --- a/dali/operators/generic/one_hot.cc +++ b/dali/operators/generic/one_hot.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// Copyright (c) 2017-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -22,7 +22,7 @@ namespace dali { DALI_SCHEMA(OneHot) .DocStr(R"code(Produces a one-hot encoding of the input. -Adds a new axis or converts scalar input into an axis of ``num_classes`` elements. +Adds a new axis or converts scalar input into an axis of `num_classes` elements. For given input coordinate ``(x0, x1, ..., xn)``, and ``axis = k``, the output sample is specified as:: @@ -31,14 +31,14 @@ For given input coordinate ``(x0, x1, ..., xn)``, and ``axis = k``, the output s for all ``i`` in range ``[0, num_classes)``. -For scalars, the output is set to ``on_value`` at the index taken from ``input`` and -``off_value`` elsewhere:: +For scalars, the output is set to `on_value` at the index taken from ``input`` and +`off_value` elsewhere:: output[i] = on_value if i == input else off_value For backward compatibility, any input in which all tensors have only one element (regardless of the number of dimensions) is considered scalar. Legacy interpretation of tensors -as scalars is not supported if ``axis`` argument is specified.)code") +as scalars is not supported if `axis` argument is specified.)code") .NumInput(1) .NumOutput(1) .AddOptionalArg("num_classes", R"code(Number of all classes in the data.)code", 0) @@ -50,12 +50,12 @@ it becomes the only dimension.)code", -1) R"code(Value that will be used to fill the output to indicate given class in the corresponding input coordinate. -This value will be cast to the ``dtype`` type.)code", 1.f) +This value will be cast to the `dtype` type.)code", 1.f) .AddOptionalArg("off_value", R"code(Value that will be used to fill the output to indicate the lack of given class in the corresponding input coordinate. -This value will be cast to the ``dtype`` type.)code", 0.f) +This value will be cast to the `dtype` type.)code", 0.f) .AddOptionalArg("axis_name", R"code(Single character that will be used as a name for the newly added dimension in the output layout. If no character is provided, the output layout will be diff --git a/dali/operators/generic/pad.cc b/dali/operators/generic/pad.cc index 52b5b9d1b4e..4493311d651 100644 --- a/dali/operators/generic/pad.cc +++ b/dali/operators/generic/pad.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2020-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// Copyright (c) 2020-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -24,7 +24,7 @@ namespace dali { DALI_SCHEMA(Pad) - .DocStr(R"code(Pads all samples with the ``fill_value`` in the specified axes to match + .DocStr(R"code(Pads all samples with the `fill_value` in the specified axes to match the biggest extent in the batch for those axes or to match the minimum shape specified. Here are a few examples: @@ -154,28 +154,28 @@ axis to match the largest sample in the batch and an alignment of 2. Negative values are interpreted as counting dimensions from the back. Valid range: ``[-ndim, ndim-1]``, where ndim is the number of dimensions in the input data. -The ``axis_names`` and ``axes`` arguments are mutually exclusive. If ``axes`` and ``axis_names`` +The `axis_names` and `axes` arguments are mutually exclusive. If `axes` and `axis_names` are empty, or have not been provided, the output will be padded on all of the axes.)code", std::vector(), true) .AddOptionalArg("axis_names", R"code(Names of the axes on which the batch samples will be padded. -The ``axis_names`` and ``axes`` arguments are mutually exclusive. If ``axes`` and ``axis_names`` +The `axis_names` and `axes` arguments are mutually exclusive. If `axes` and `axis_names` are empty, or have not been provided, the output will be padded on all of the axes.)code", "") .AddOptionalArg("align", R"code(If specified, this argument determines the alignment on the dimensions specified -by ``axes`` or ``axis_names``. +by `axes` or `axis_names`. The extent on ``axis = axes[i]`` will be adjusted to be a multiple of ``align[i]``. If an integer value is provided, the alignment restrictions are applied to all the padded axes. To use alignment only, that is without any default or explicit padding behavior, -set the minimum ``shape`` to 1 for the specified axis.)code", +set the minimum `shape` to 1 for the specified axis.)code", std::vector(), true) .AddOptionalArg("shape", - R"code(The extents of the output shape in the axes specified by the ``axes`` or ``axis_names``. + R"code(The extents of the output shape in the axes specified by the `axes` or `axis_names`. Specifying -1 for an axis restores the default behavior of extending the axis to accommodate the aligned size of the largest sample in the batch. diff --git a/dali/operators/generic/permute_batch.cc b/dali/operators/generic/permute_batch.cc index 23943394b19..a7d3f02ebda 100644 --- a/dali/operators/generic/permute_batch.cc +++ b/dali/operators/generic/permute_batch.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2020-2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// Copyright (c) 2020-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -19,7 +19,7 @@ namespace dali { DALI_SCHEMA(PermuteBatch) .DocStr(R"(Returns a batch of tensors constructed by selecting tensors from the input based -on indices given in ``indices`` argument:: +on indices given in `indices` argument:: out_tensor[i] = in_tensor[indices[i]] diff --git a/dali/operators/generic/reduce/reduce.cc b/dali/operators/generic/reduce/reduce.cc index e99b7fbbb93..d1bcf17d777 100644 --- a/dali/operators/generic/reduce/reduce.cc +++ b/dali/operators/generic/reduce/reduce.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2020-2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// Copyright (c) 2020-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -34,7 +34,7 @@ Not providing any axis results in reduction of all elements.)code", .AddOptionalArg("axis_names", R"code(Name(s) of the axis or axes along which the reduction is performed. The input layout is used to translate the axis names to axis indices, for example ``axis_names="HW"`` with input -layout `"FHWC"` is equivalent to specifying ``axes=[1,2]``. This argument cannot be used together with ``axes``.)code", +layout `"FHWC"` is equivalent to specifying ``axes=[1,2]``. This argument cannot be used together with `axes`.)code", nullptr) .AddOptionalArg( "keep_dims", diff --git a/dali/operators/generic/reshape.cc b/dali/operators/generic/reshape.cc index f96af16c935..f7edc739135 100644 --- a/dali/operators/generic/reshape.cc +++ b/dali/operators/generic/reshape.cc @@ -32,7 +32,7 @@ The buffer contents are not copied.)code") .NumInput(1, 2) .NumOutput(1) .InputDox(0, "data", "TensorList", "Data to be reshaped") - .InputDox(1, "shape_input", "1D TensorList of integers", "Same as ``shape`` keyword argument") + .InputDox(1, "shape_input", "1D TensorList of integers", "Same as `shape` keyword argument") .InputDevice(1, InputDevice::CPU) .PassThrough({{0, 0}}) .AllowSequences() @@ -44,16 +44,16 @@ For example, an input of shape ``[480, 640, 3]`` and ``shape = [240, -1]`` results in the output shape ``[240, 3840]``. .. note:: - ``rel_shape`` and ``shape`` are mutually exclusive. + `rel_shape` and `shape`.are mutually exclusive. )code", std::vector(), true) .AddOptionalArg("rel_shape", R"code(The relative shape of the output. -The output shape is calculated by multiplying the input shape by ``rel_shape``:: +The output shape is calculated by multiplying the input shape by `rel_shape`:: out_shape[i] = in_shape[i] * rel_shape[i] -An additional argument ``src_dims`` may be used to alter which source dimension is used +An additional argument `src_dims` may be used to alter which source dimension is used for calculating the output shape:: out_shape[i] = in_shape[src_dims[i]] * rel_shape[i] @@ -64,14 +64,14 @@ the output shape ``[240, 3840]``. The number of dimensions is subject to the following restrictions: -- if ``src_dims`` argument is used, the number of elements in ``src_dims`` - and ``rel_shape`` must match -- otherwise, the length of ``rel_shape`` must not exceed the number of dimensions in the input - except when the last element in ``rel_shape`` is negative, in which case an extra dimension at +- if `src_dims` argument is used, the number of elements in `src_dims` + and `rel_shape` must match +- otherwise, the length of `rel_shape` must not exceed the number of dimensions in the input + except when the last element in `rel_shape` is negative, in which case an extra dimension at the end will be added .. note:: - ``rel_shape`` and ``shape`` are mutually exclusive. + `rel_shape` and `shape`.are mutually exclusive. )code", std::vector(), true) .AddOptionalArg("layout", R"code(New layout for the data. @@ -86,12 +86,12 @@ of the output.)code", This argument can be used to manipulate the order of existing dimensions or to remove or add dimension. A special index value -1 can be used to insert new dimensions. -For example, reshaping a sample with shape ``[300, 200, 1]`` and a ``src_dims`` +For example, reshaping a sample with shape ``[300, 200, 1]`` and a `src_dims` argument ``[-1, 1, 0]`` produces an output shape ``[1, 200, 300]``. A leading dimension with extent 1 is inserted at the beginning, followed by the first original dimensions but in reverse order. The last dimension is removed. -The ``src_dims`` argument can be used together with `rel_shape`, in which case the relative +The `src_dims` argument can be used together with `rel_shape`, in which case the relative extents in `rel_shape` describe to the target dimensions. In the example above, specifying ``rel_shape = [-1, 0.5, 2]`` would result in the output shape ``[1, 100, 600]``. @@ -105,7 +105,7 @@ The buffer contents are not copied.)") .NumInput(1, 2) .NumOutput(1) .InputDox(0, "data", "TensorList", "Data to be reshaped") - .InputDox(1, "shape_input", "1D TensorList of integers", "Same as ``shape`` keyword argument") + .InputDox(1, "shape_input", "1D TensorList of integers", "Same as `shape` keyword argument") .InputDevice(1, InputDevice::CPU) .PassThrough({{0, 0}}) .AllowSequences() diff --git a/dali/operators/generic/roi_random_crop.cc b/dali/operators/generic/roi_random_crop.cc index 68998fe4ef3..4e4e3071ab3 100644 --- a/dali/operators/generic/roi_random_crop.cc +++ b/dali/operators/generic/roi_random_crop.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2021-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// Copyright (c) 2021-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -27,7 +27,7 @@ provided region of interest (ROI) is contained in it. If the ROI is bigger than the cropping window, the cropping window will be a subwindow of the ROI. If the ROI is smaller than the cropping window, the whole ROI shall be contained in the cropping window. -If an input shape (``in_shape``) is given, the resulting cropping window is selected to be within the +If an input shape (`in_shape`) is given, the resulting cropping window is selected to be within the bounds of that input shape. Alternatively, the input data subject to cropping can be passed to the operator, in the operator. When providing an input shape, the region of interest should be within the bounds of the input and the cropping window shape should not be larger than the input shape. @@ -35,8 +35,8 @@ input and the cropping window shape should not be larger than the input shape. If no input shape is provided, the resulting cropping window is unbounded, potentially resulting in out of bounds cropping. -The cropping window dimensions should be explicitly provided (``crop_shape``), and the ROI should be -either specified with ``roi_start``/``roi_end`` or ``roi_start``/``roi_shape``. +The cropping window dimensions should be explicitly provided (`crop_shape`), and the ROI should be +either specified with `roi_start`/`roi_end` or `roi_start`/`roi_shape`. The operator produces an output representing the cropping window start coordinates. )code") @@ -48,13 +48,13 @@ The operator produces an output representing the cropping window start coordinat R"code(ROI end coordinates. .. note:: - Using ``roi_end`` is mutually exclusive with ``roi_shape``. + Using `roi_end` is mutually exclusive with `roi_shape`. )code", nullptr, true) .AddOptionalArg>("roi_shape", R"code(ROI shape. .. note:: - Using ``roi_shape`` is mutually exclusive with ``roi_end``. + Using `roi_shape` is mutually exclusive with `roi_end`. )code", nullptr, true) .AddOptionalArg>("in_shape", R"code(Shape of the input data. @@ -63,7 +63,7 @@ If provided, the cropping window start will be selected so that the cropping win bounds of the input. .. note:: - Providing ``in_shape`` is incompatible with feeding the input data directly as a positional input. + Providing `in_shape` is incompatible with feeding the input data directly as a positional input. )code", nullptr, true) .NumInput(0, 1) .NumOutput(1); diff --git a/dali/operators/generic/slice/out_of_bounds_attr.cc b/dali/operators/generic/slice/out_of_bounds_attr.cc index 8603e687388..502ac9d3731 100644 --- a/dali/operators/generic/slice/out_of_bounds_attr.cc +++ b/dali/operators/generic/slice/out_of_bounds_attr.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2020-2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// Copyright (c) 2020-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -27,10 +27,10 @@ Here is a list of the supported values: - ``"error"`` (default): Attempting to slice outside of the bounds of the input will produce an error. - ``"pad"``: The input will be padded as needed with zeros or any other value that is specified - with the ``fill_values`` argument. + with the `fill_values` argument. - ``"trim_to_shape"``: The slice window will be cut to the bounds of the input.)code", "error") .AddOptionalArg("fill_values", - R"code(Determines padding values and is only relevant if ``out_of_bounds_policy`` + R"code(Determines padding values and is only relevant if `out_of_bounds_policy` is set to “pad”. If a scalar value is provided, it will be used for all the channels. If multiple values are diff --git a/dali/operators/generic/slice/slice.cc b/dali/operators/generic/slice/slice.cc index e9f4ac81197..8787dc391d2 100644 --- a/dali/operators/generic/slice/slice.cc +++ b/dali/operators/generic/slice/slice.cc @@ -30,30 +30,30 @@ and shape of the slice. Both coordinates and shapes can be provided in absolute The slice arguments can be specified by the following named arguments: -#. ``start``: Slice start coordinates (absolute) -#. ``rel_start``: Slice start coordinates (relative) -#. ``end``: Slice end coordinates (absolute) -#. ``rel_end``: Slice end coordinates (relative) -#. ``shape``: Slice shape (absolute) -#. ``rel_shape``: Slice shape (relative) +#. `start`: Slice start coordinates (absolute) +#. `rel_start`: Slice start coordinates (relative) +#. `end`: Slice end coordinates (absolute) +#. `rel_end`: Slice end coordinates (relative) +#. `shape`: Slice shape (absolute) +#. `rel_shape`: Slice shape (relative) The slice can be configured by providing start and end coordinates or start and shape. -Relative and absolute arguments can be mixed (for example, ``rel_start`` can be used with ``shape``) +Relative and absolute arguments can be mixed (for example, `rel_start` can be used with `shape`) as long as start and shape or end are uniquely defined. -Alternatively, two extra positional inputs can be provided, specifying ``anchor`` and ``shape``. -When using positional inputs, two extra boolean arguments ``normalized_anchor``/``normalized_shape`` +Alternatively, two extra positional inputs can be provided, specifying ``anchor`` and `shape`. +When using positional inputs, two extra boolean arguments `normalized_anchor`/`normalized_shape` can be used to specify the nature of the arguments provided. Using positional inputs for anchor and shape is incompatible with the named arguments specified above. .. note:: - For GPU backend and positional inputs ``anchor`` and ``shape``, both CPU and GPU data nodes + For GPU backend and positional inputs ``anchor`` and `shape`. both CPU and GPU data nodes are accepted, though CPU inputs are preferred. Providing those arguments as GPU inputs will result in an additional device-to-host copy with its associated synchronization point. - When possible, provide ``anchor`` and ``shape`` as CPU inputs. + When possible, provide ``anchor`` and `shape`.as CPU inputs. -The slice arguments should provide as many dimensions as specified by the ``axis_names`` or ``axes`` +The slice arguments should provide as many dimensions as specified by the `axis_names` or `axes` arguments. By default, the :meth:`nvidia.dali.fn.slice` operator uses normalized coordinates and ``WH`` @@ -68,14 +68,14 @@ point of the slice (x0, x1, x2, …). Integer coordinates are interpreted as absolute coordinates, while float coordinates can be interpreted as absolute or relative coordinates, depending on the value of -``normalized_anchor``.)code") +`normalized_anchor`.)code") .InputDox(2, "shape", "1D TensorList of float or int", R"code((Optional) Input that contains normalized or absolute coordinates for the dimensions of the slice (s0, s1, s2, …). Integer coordinates are interpreted as absolute coordinates, while float coordinates can be interpreted as absolute or relative coordinates, depending on the value of -``normalized_shape``.)code") +`normalized_shape`.)code") .SupportVolumetric() .AddOptionalArg("image_type", "Image type", nullptr) .DeprecateArg("image_type") // deprecated since 0.24dev diff --git a/dali/operators/generic/slice/slice_attr.cc b/dali/operators/generic/slice/slice_attr.cc index 44c477a2d78..437e591f5bc 100644 --- a/dali/operators/generic/slice/slice_attr.cc +++ b/dali/operators/generic/slice/slice_attr.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2019-2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// Copyright (c) 2019-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -33,42 +33,42 @@ Valid range: ``[-ndim, ndim-1]``, where ndim is the number of dimensions in the R"code(Order of the dimensions used for the anchor and shape slice inputs, as described in layout. -If a value is provided, ``axis_names`` will have a higher priority than ``axes``.)code", +If a value is provided, `axis_names` will have a higher priority than `axes`.)code", TensorLayout("WH")) .AddOptionalArg>("start", R"code(Start coordinates of the slice. -Note: Providing named arguments ``start``/``end`` or ``start``/``shape`` is incompatible with +Note: Providing named arguments `start`/`end` or `start`/`shape` is incompatible with providing positional inputs anchor and shape.)code", nullptr, true) .AddOptionalArg>("rel_start", R"code(Start relative coordinates of the slice (range [0.0 - 1.0]). -Note: Providing named arguments ``start``, ``end``, ``shape``, ``rel_start``, ``rel_end``, ``rel_shape`` +Note: Providing named arguments `start`, `end`, `shape`, `rel_start`, `rel_end`, `rel_shape` is incompatible with providing positional inputs anchor and shape.)code", nullptr, true) .AddOptionalArg>("end", R"code(End coordinates of the slice. -Note: Providing named arguments ``start``, ``end``, ``shape``, ``rel_start``, ``rel_end``, ``rel_shape`` +Note: Providing named arguments `start`, `end`, `shape`, `rel_start`, `rel_end`, `rel_shape` is incompatible with providing positional inputs anchor and shape.)code", nullptr, true) .AddOptionalArg>("rel_end", R"code(End relative coordinates of the slice (range [0.0 - 1.0]. -Note: Providing named arguments ``start``, ``end``, ``shape``, ``rel_start``, ``rel_end``, ``rel_shape`` +Note: Providing named arguments `start`, `end`, `shape`, `rel_start`, `rel_end`, `rel_shape` is incompatible with providing positional inputs anchor and shape.)code", nullptr, true) .AddOptionalArg>("shape", R"code(Shape of the slice. -Providing named arguments ``start``, ``end``, ``shape``, ``rel_start``, ``rel_end``, ``rel_shape`` +Providing named arguments `start`, `end`, `shape`, `rel_start`, `rel_end`, `rel_shape` is incompatible with providing positional inputs anchor and shape.)code", nullptr, true) .AddOptionalArg>("rel_shape", R"code(Relative shape of the slice (range [0.0 - 1.0]). -Providing named arguments ``start``, ``end``, ``shape``, ``rel_start``, ``rel_end``, ``rel_shape`` +Providing named arguments `start`, `end`, `shape`, `rel_start`, `rel_end`, `rel_shape` is incompatible with providing positional inputs anchor and shape.)code", nullptr, true) .AddOptionalArg("normalized_anchor", diff --git a/dali/operators/generic/slice/slice_attr.h b/dali/operators/generic/slice/slice_attr.h index 93f89f43f0b..4582cbeabe7 100644 --- a/dali/operators/generic/slice/slice_attr.h +++ b/dali/operators/generic/slice/slice_attr.h @@ -1,4 +1,4 @@ -// Copyright (c) 2019-2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// Copyright (c) 2019-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -366,7 +366,7 @@ class SliceAttr { if (use_named_args_) { if (spec.HasArgument("normalized_anchor") || spec.HasArgument("normalized_shape")) { DALI_WARN( - "Warning: ``normalized_anchor``/``normalized_shape`` is only relevant " + "Warning: ``normalized_anchor``/`normalized_shape` is only relevant " "when using positional slice arguments"); } DALI_ENFORCE(ws.NumInput() == spec.GetSchema().MinNumInput(), diff --git a/dali/operators/generic/squeeze.cc b/dali/operators/generic/squeeze.cc index dcd92ac3f11..00871ae9445 100644 --- a/dali/operators/generic/squeeze.cc +++ b/dali/operators/generic/squeeze.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2021-2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// Copyright (c) 2021-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -25,7 +25,7 @@ namespace dali { DALI_SCHEMA(Squeeze) - .DocStr(R"code(Removes the dimensions given as ``axes`` or ``axis_names``. + .DocStr(R"code(Removes the dimensions given as `axes` or `axis_names`. It's an error to remove a dimension that would cause the total volume to change.)code") .NumInput(1) @@ -50,8 +50,8 @@ Squeeze::Squeeze(const OpSpec &spec) axis_names_ = spec.GetArgument("axis_names"); DALI_ENFORCE(spec.HasArgument("axes") + spec.HasArgument("axis_names") == 1, - spec.HasArgument("axes") ? "Provided both ``axes`` and ``axis_names`` arguments" - : "Missing argument ``axes`` or ``axis_names``."); + spec.HasArgument("axes") ? "Provided both `axes` and `axis_names` arguments" + : "Missing argument `axes` or `axis_names`."); this->use_src_dims_ = true; } diff --git a/dali/operators/generic/transpose/transpose.cc b/dali/operators/generic/transpose/transpose.cc index 1ef632c406f..7840c135cfe 100644 --- a/dali/operators/generic/transpose/transpose.cc +++ b/dali/operators/generic/transpose/transpose.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2019-2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// Copyright (c) 2019-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -61,7 +61,7 @@ DALI_REGISTER_OPERATOR(Transpose, TransposeCPU, CPU); DALI_SCHEMA(Transpose) .DocStr(R"code(Transposes the tensors by reordering the dimensions based on -the ``perm`` parameter. +the `perm` parameter. Destination dimension ``i`` is obtained from source dimension ``perm[i]``. @@ -89,15 +89,15 @@ If not given, the dimensions are reversed.)code", .AddOptionalArg( "transpose_layout", R"code(When set to True, the axis names in the output data layout are permuted according -to ``perm``, Otherwise, the input layout is copied to the output. +to `perm`, Otherwise, the input layout is copied to the output. -If ``output_layout`` is set, this argument is ignored.)code", +If `output_layout` is set, this argument is ignored.)code", true) .AddOptionalArg( "output_layout", R"code(Explicitly sets the output data layout. -If this argument is specified, ``transpose_layout`` is ignored.)code", +If this argument is specified, `transpose_layout` is ignored.)code", TensorLayout("")); } // namespace dali diff --git a/dali/operators/geometry/affine_transforms/transform_crop.cc b/dali/operators/geometry/affine_transforms/transform_crop.cc index 2ceabc0628f..6e6d4d87bf8 100644 --- a/dali/operators/geometry/affine_transforms/transform_crop.cc +++ b/dali/operators/geometry/affine_transforms/transform_crop.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2020-2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// Copyright (c) 2020-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -20,8 +20,8 @@ namespace dali { DALI_SCHEMA(transforms__Crop) .DocStr(R"code(Produces an affine transform matrix that maps a reference coordinate space to another one. -This transform can be used to adjust coordinates after a crop operation so that a ``from_start`` point will -be mapped to ``to_start`` and ``from_end`` will be mapped to ``to_end``. +This transform can be used to adjust coordinates after a crop operation so that a `from_start` point will +be mapped to `to_start` and `from_end` will be mapped to `to_end`. If another transform matrix is passed as an input, the operator applies the transformation to the matrix provided. diff --git a/dali/operators/geometry/affine_transforms/transform_rotation.cc b/dali/operators/geometry/affine_transforms/transform_rotation.cc index da9058ac740..49b84c94bae 100644 --- a/dali/operators/geometry/affine_transforms/transform_rotation.cc +++ b/dali/operators/geometry/affine_transforms/transform_rotation.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2020-2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// Copyright (c) 2020-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -39,7 +39,7 @@ The number of dimensions is assumed to be 3 if a rotation axis is provided or 2 The vector does not need to be normalized, but it must have a non-zero length. -Reversing the vector is equivalent to changing the sign of ``angle``.)code", +Reversing the vector is equivalent to changing the sign of `angle`.)code", nullptr, true, true) .AddOptionalArg>( "center", diff --git a/dali/operators/geometry/affine_transforms/transform_scale.cc b/dali/operators/geometry/affine_transforms/transform_scale.cc index 18c18e460e4..791bfbb43ec 100644 --- a/dali/operators/geometry/affine_transforms/transform_scale.cc +++ b/dali/operators/geometry/affine_transforms/transform_scale.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2020-2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// Copyright (c) 2020-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -35,7 +35,7 @@ The number of dimensions of the transform is inferred from this argument.)code", "center", R"code(The center of the scale operation. -If provided, the number of elements should match the one of ``scale`` argument.)code", +If provided, the number of elements should match the one of `scale` argument.)code", nullptr, true, true) .AddOptionalArg( "ndim", diff --git a/dali/operators/geometry/affine_transforms/transform_shear.cc b/dali/operators/geometry/affine_transforms/transform_shear.cc index 5e365adcde3..1a9e170cd8c 100644 --- a/dali/operators/geometry/affine_transforms/transform_shear.cc +++ b/dali/operators/geometry/affine_transforms/transform_shear.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2020-2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// Copyright (c) 2020-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -31,15 +31,15 @@ If another transform matrix is passed as an input, the operator applies the shea "shear", R"code(The shear factors. -For 2D, ``shear`` contains two elements: shear_x, shear_y. +For 2D, `shear` contains two elements: shear_x, shear_y. -For 3D, ``shear`` contains six elements: shear_xy, shear_xz, shear_yx, shear_yz, shear_zx, shear_zy. +For 3D, `shear` contains six elements: shear_xy, shear_xz, shear_yx, shear_yz, shear_zx, shear_zy. A shear factor value can be interpreted as the offset to be applied in the first axis when moving in the direction of the second axis. .. note:: - This argument is mutually exclusive with ``angles``. + This argument is mutually exclusive with `angles`. If provided, the number of dimensions of the transform is inferred from this argument. )code", nullptr, true, true) @@ -47,11 +47,11 @@ direction of the second axis. "angles", R"code(The shear angles, in degrees. -This argument is mutually exclusive with ``shear``. +This argument is mutually exclusive with `shear`. -For 2D, ``angles`` contains two elements: angle_x, angle_y. +For 2D, `angles` contains two elements: angle_x, angle_y. -For 3D, ``angles`` contains six elements: angle_xy, angle_xz, angle_yx, angle_yz, angle_zx, angle_zy. +For 3D, `angles` contains six elements: angle_xy, angle_xz, angle_yx, angle_yz, angle_zx, angle_zy. A shear angle is translated to a shear factor as follows:: @@ -59,7 +59,7 @@ A shear angle is translated to a shear factor as follows:: .. note:: The valid range of values is between -90 and 90 degrees. - This argument is mutually exclusive with ``shear``. + This argument is mutually exclusive with `shear`. If provided, the number of dimensions of the transform is inferred from this argument. )code", nullptr, true, true) diff --git a/dali/operators/geometry/coord_transform.cc b/dali/operators/geometry/coord_transform.cc index 67134130dfd..82cbd51e391 100644 --- a/dali/operators/geometry/coord_transform.cc +++ b/dali/operators/geometry/coord_transform.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2020-2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// Copyright (c) 2020-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -25,7 +25,7 @@ The transformation has the form:: out = M * in + T -Where ``M`` is a ``m x n`` matrix and ``T`` is a translation vector with `m` components. +Where `M` is a ``m x n`` matrix and `T` is a translation vector with `m` components. Input must consist of n-element vectors or points and the output has `m` components. This operator can be used for many operations. Here's the (incomplete) list: diff --git a/dali/operators/geometry/mt_transform_attr.cc b/dali/operators/geometry/mt_transform_attr.cc index b85ffbc7342..72235a42ba3 100644 --- a/dali/operators/geometry/mt_transform_attr.cc +++ b/dali/operators/geometry/mt_transform_attr.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2020-2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// Copyright (c) 2020-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -28,10 +28,10 @@ M and translation T or one fused argument MT.)") If left unspecified, identity matrix is used. -The matrix ``M`` does not need to be square - if it's not, the output vectors will have a -number of components equal to the number of rows in ``M``. +The matrix `M` does not need to be square - if it's not, the output vectors will have a +number of components equal to the number of rows in `M`. -If a scalar value is provided, ``M`` is assumed to be a square matrix with that value on the +If a scalar value is provided, `M` is assumed to be a square matrix with that value on the diagonal. The size of the matrix is then assumed to match the number of components in the input vectors.)", nullptr, // no default value @@ -40,17 +40,17 @@ input vectors.)", If left unspecified, no translation is applied unless MT argument is used. -The number of components of this vector must match the number of rows in matrix ``M``. -If a scalar value is provided, that value is broadcast to all components of ``T`` and the number -of components is chosen to match the number of rows in ``M``.)", nullptr, true, true) +The number of components of this vector must match the number of rows in matrix `M`. +If a scalar value is provided, that value is broadcast to all components of `T` and the number +of components is chosen to match the number of rows in `M`.)", nullptr, true, true) .AddOptionalArg>("MT", R"(A block matrix [M T] which combines the arguments -``M`` and ``T``. +`M` and `T`. Providing a scalar value for this argument is equivalent to providing the same scalar for M and leaving T unspecified. The number of columns must be one more than the number of components in the input. -This argument is mutually exclusive with ``M`` and ``T``.)", +This argument is mutually exclusive with `M` and `T`.)", nullptr, true, true); void MTTransformAttr::ProcessMatrixArg(const OpSpec &spec, const ArgumentWorkspace &ws, int N) { diff --git a/dali/operators/image/color/color_twist.cc b/dali/operators/image/color/color_twist.cc index f2c8ad20608..a3f1fabf815 100644 --- a/dali/operators/image/color/color_twist.cc +++ b/dali/operators/image/color/color_twist.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2020-2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// Copyright (c) 2020-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -22,8 +22,8 @@ DALI_SCHEMA(Hsv) .DocStr(R"code(Adjusts hue, saturation and value (brightness) of the images. To change the hue, the saturation, and/or the value of the image, pass the corresponding -coefficients. Remember that the ``hue`` is an additive delta argument, -while for ``saturation`` and ``value``, the arguments are multiplicative. +coefficients. Remember that the `hue` is an additive delta argument, +while for `saturation` and `value`, the arguments are multiplicative. This operator accepts images in the RGB color space. diff --git a/dali/operators/image/convolution/filter.cc b/dali/operators/image/convolution/filter.cc index 84b112439c4..cf9bf013304 100644 --- a/dali/operators/image/convolution/filter.cc +++ b/dali/operators/image/convolution/filter.cc @@ -103,7 +103,7 @@ Supported values are: ``"reflect_101"``, ``"reflect_1001"``, ``"wrap"``, .AddOptionalArg("mode", R"code(Supported values are: ``"same"`` and ``"valid"``. -- ``"same"`` (default): The input and output sizes are the same and ``border`` is used +- ``"same"`` (default): The input and output sizes are the same and `border` is used to handle out-of-bound filter positions. - ``"valid"``: the output sample is cropped (by ``filter_extent - 1``) so that all filter positions lie fully within the input sample. diff --git a/dali/operators/image/convolution/gaussian_blur.cc b/dali/operators/image/convolution/gaussian_blur.cc index f77aa70d3fe..338ae919a85 100644 --- a/dali/operators/image/convolution/gaussian_blur.cc +++ b/dali/operators/image/convolution/gaussian_blur.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2020-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// Copyright (c) 2020-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -34,7 +34,7 @@ DALI_SCHEMA(GaussianBlur) .DocStr(R"code(Applies a Gaussian Blur to the input. Gaussian blur is calculated by applying a convolution with a Gaussian kernel, which can be -parameterized with ``windows_size`` and ``sigma``. +parameterized with ``windows_size`` and `sigma`. If only the sigma is specified, the radius of the Gaussian kernel defaults to ``ceil(3 * sigma)``, so the kernel window size is ``2 * ceil(3 * sigma) + 1``. diff --git a/dali/operators/image/convolution/laplacian.cc b/dali/operators/image/convolution/laplacian.cc index 3bd960c52a0..8426ff65c11 100644 --- a/dali/operators/image/convolution/laplacian.cc +++ b/dali/operators/image/convolution/laplacian.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2021-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// Copyright (c) 2021-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -39,13 +39,13 @@ that uses a derivative window in the direction of the partial derivative and smo in the remaining axes. By default, each partial derivative is approximated by convolving along all spatial axes: the axis -in partial derivative direction uses derivative window of ``window_size`` and the remaining -axes are convolved with smoothing windows of the same size. If ``smoothing_size`` is specified, +in partial derivative direction uses derivative window of `window_size` and the remaining +axes are convolved with smoothing windows of the same size. If `smoothing_size` is specified, the smoothing windows applied to a given axis can have different size than the derivative window. Specifying ``smoothing_size = 1`` implies no smoothing in axes perpendicular to the derivative direction. -Both ``window_size`` and ``smoothing_size`` can be specified as a single value or per axis. +Both `window_size` and `smoothing_size` can be specified as a single value or per axis. For example, for volumetric input, if ``window_size=[dz, dy, dx]`` and ``smoothing_size=[sz, sy, sx]`` are specified, the following windows will be used: @@ -62,7 +62,7 @@ Smoothing window can be of size 1, which implies no smoothing along correspondin To normalize partial derivatives, ``normalized_kernel=True`` can be used. Each partial derivative is scaled by ``2^(-s + n + 2)``, where ``s`` is the sum of the window sizes used to calculate a given partial derivative (including the smoothing windows) and ``n`` is the number of data -dimensions/axes. Alternatively, you can specify ``scale`` argument to customize scaling factors. +dimensions/axes. Alternatively, you can specify `scale` argument to customize scaling factors. Scale can be either a single value or ``n`` values, one for every partial derivative. Operator uses 32-bit floats as an intermediate type. @@ -92,7 +92,7 @@ Smoothing size must be odd and between 1 and 23.)code", .AddOptionalArg( laplacian::normalizeArgName, "If set to True, automatically scales partial derivatives kernels. Must be False " - "if ``scale`` is specified.", + "if `scale` is specified.", laplacian::normalizeArgDefault) .AddOptionalTypeArg("dtype", R"code(Output data type. diff --git a/dali/operators/image/crop/bbox_crop.cc b/dali/operators/image/crop/bbox_crop.cc index 1ba471009aa..d4d243f879e 100644 --- a/dali/operators/image/crop/bbox_crop.cc +++ b/dali/operators/image/crop/bbox_crop.cc @@ -110,12 +110,12 @@ boxes will be adjusted or filtered out to match the cropped ROI. The applied ran is constrained by the arguments that are provided to the operator. The cropping window candidates are randomly selected until one matches the overlap restrictions -that are specified by the ``thresholds`` argument. ``thresholds`` values represent a minimum overlap -metric that is specified by ``threshold_type``, such as the intersection-over-union of the cropping +that are specified by the `thresholds` argument. `thresholds` values represent a minimum overlap +metric that is specified by `threshold_type`, such as the intersection-over-union of the cropping window and the bounding boxes or the relative overlap as a ratio of the intersection area and the bounding box area. -Additionally, if ``allow_no_crop`` is True, the cropping may be skipped entirely as one of +Additionally, if `allow_no_crop` is True, the cropping may be skipped entirely as one of the valid results of the operator. The following modes of a random crop are available: @@ -123,21 +123,21 @@ The following modes of a random crop are available: - | Randomly shaped window, which is randomly placed in the original input space. | The random crop window dimensions are selected to satisfy the aspect ratio and relative area restrictions. - | If ``input_shape`` is provided, it will be taken into account for the aspect ratio range check. + | If `input_shape` is provided, it will be taken into account for the aspect ratio range check. | Otherwise, the aspect ratios are calculated in relative terms. - | In other words, without ``input_shape``, an aspect ratio of 1.0 is equivalent to the aspect ratio of the input image. + | In other words, without `input_shape`, an aspect ratio of 1.0 is equivalent to the aspect ratio of the input image. - | Fixed size window, which is randomly placed in the original input space. - | The random crop window dimensions are taken from the ``crop_shape`` argument and the anchor is + | The random crop window dimensions are taken from the `crop_shape` argument and the anchor is | randomly selected. - | When providing ``crop_shape``, ``input_shape`` is also required (these dimensions are required to + | When providing `crop_shape`, `input_shape` is also required (these dimensions are required to | scale the output bounding boxes). The num_attempts argument can be used to control the maximum number of attempts to produce -a valid crop to match a minimum overlap metric value from ``thresholds``. +a valid crop to match a minimum overlap metric value from `thresholds`. .. warning:: - When ``allow_no_crop`` is False and ``thresholds`` does not contain ``0.0``, if - you do not increase the ``num_attempts`` value, it might continue to loop for a long time. + When `allow_no_crop` is False and `thresholds` does not contain ``0.0``, if + you do not increase the `num_attempts` value, it might continue to loop for a long time. **Inputs: 0**: bboxes, (1: labels) @@ -147,10 +147,10 @@ refers to the index of the coordinate. The coordinates are relative to the original image dimensions (that means, a range of ``[0.0, 1.0]``) that represent the start and, depending on the value of -bbox_layout, the end of the region or start and shape. For example, ``bbox_layout``\="xyXY" +bbox_layout, the end of the region or start and shape. For example, `bbox_layout`\="xyXY" means the bounding box coordinates follow the ``start_x``, ``start_y``, ``end_x``, -and ``end_y`` order, and ``bbox_layout``\="xyWH" indicates that the order is ``start_x``, -``start_y``, ``width``, and ``height``. See the ``bbox_layout`` argument description +and ``end_y`` order, and `bbox_layout`\="xyWH" indicates that the order is ``start_x``, +``start_y``, ``width``, and ``height``. See the `bbox_layout` argument description for more information. An optional input ``labels`` can be provided, representing the labels that are associated with each of @@ -158,16 +158,16 @@ the bounding boxes. **Outputs: 0**: anchor, 1: shape, 2: bboxes (, 3: labels, 4: bboxes_indices) -The resulting crop parameters are provided as two separate outputs, ``anchor`` and ``shape``, +The resulting crop parameters are provided as two separate outputs, ``anchor`` and `shape`. that can be fed directly to the :meth:`nvidia.dali.fn.slice` operator to complete the cropping -of the original image. ``anchor`` and ``shape`` contain the starting coordinates and dimensions +of the original image. ``anchor`` and `shape`.contain the starting coordinates and dimensions for the crop in the ``[x, y, (z)]`` and ``[w, h, (d)]`` formats, respectively. The coordinates can be represented in absolute or relative terms, and the representation depends on whether -the fixed ``crop_shape`` was used. +the fixed `crop_shape` was used. .. note:: - Both ``anchor`` and ``shape`` are returned as a ``float``, even if they represent absolute - coordinates due to providing ``crop_shape`` argument. In order for them to be interpreted + Both ``anchor`` and `shape`.are returned as a ``float``, even if they represent absolute + coordinates due to providing `crop_shape` argument. In order for them to be interpreted correctly by :meth:`nvidia.dali.fn.slice`, ``normalized_anchor`` and ``normalized_shape`` should be set to False. @@ -180,7 +180,7 @@ The output will be present if a labels input was provided. The last output, also optional, corresponds to the original indices of the bounding boxes that passed the aforementioned filtering process and are present in the output. -This output will be present if the option ``output_bbox_indices`` is set to True. +This output will be present if the option `output_bbox_indices` is set to True. )code") .NumInput(1, 2) // [boxes, labels (optional),] .InputDox( @@ -196,17 +196,17 @@ associated with each of the bounding boxes.)code") }) .AddOptionalArg( "thresholds", - R"code(Minimum IoU or a different metric, if specified by ``threshold_type``, of the + R"code(Minimum IoU or a different metric, if specified by `threshold_type`, of the bounding boxes with respect to the cropping window. -Each sample randomly selects one of the ``thresholds``, and the operator will complete +Each sample randomly selects one of the `thresholds`, and the operator will complete up to the specified number of attempts to produce a random crop window that has -the selected metric above that threshold. See ``num_attempts`` for more information about +the selected metric above that threshold. See `num_attempts` for more information about configuring the number of attempts.)code", std::vector{0.f}) .AddOptionalArg( "threshold_type", - R"code(Determines the meaning of ``thresholds``. + R"code(Determines the meaning of `thresholds`. By default, thresholds refers to the intersection-over-union (IoU) of the bounding boxes with respect to the cropping window. Alternatively, the threshold can be set to "overlap" to @@ -233,13 +233,13 @@ The value for ``min`` should be greater than ``0.0``, and min should be less tha equal to the ``max`` value. By default, square windows are generated. .. note:: - Providing ``aspect_ratio`` and ``scaling`` is incompatible with explicitly - specifying ``crop_shape``. + Providing `aspect_ratio` and `scaling` is incompatible with explicitly + specifying `crop_shape`. .. note:: - If ``input_shape`` is provided, it will be taken into account for the calculation of the cropping + If `input_shape` is provided, it will be taken into account for the calculation of the cropping window aspect ratio. - Otherwise, the aspect ratio ranges are relative to the image dimensions. In other words, when ``input_shape`` + Otherwise, the aspect ratio ranges are relative to the image dimensions. In other words, when `input_shape` is not specified, an aspect ratio of 1.0 is equivalent to the original aspect ratio of the image. )code", std::vector{1.f, 1.f}) @@ -250,8 +250,8 @@ equal to the ``max`` value. By default, square windows are generated. The value of ``min`` and ``max`` must satisfy the condition ``0.0 <= min <= max``. .. note:: - Providing ``aspect_ratio`` and ``scaling`` is incompatible when explicitly specifying the - ``crop_shape`` value. + Providing `aspect_ratio` and `scaling` is incompatible when explicitly specifying the + `crop_shape` value. )code", std::vector{1.f, 1.f}) .AddOptionalArg( @@ -260,38 +260,38 @@ The value of ``min`` and ``max`` must satisfy the condition ``0.0 <= min <= max` otherwise they are provided as ``[left, top, width, height]``. .. warning:: - This argument has been deprecated. To specify the bbox encoding, use ``bbox_layout`` instead. - For example, ``ltrb=True`` is equal to ``bbox_layout``\="xyXY", and ``ltrb=False`` corresponds - to ``bbox_layout``\="xyWH". + This argument has been deprecated. To specify the bbox encoding, use `bbox_layout` instead. + For example, ``ltrb=True`` is equal to `bbox_layout`\="xyXY", and ``ltrb=False`` corresponds + to `bbox_layout`\="xyWH". )code", true) .AddOptionalArg( "num_attempts", - R"code(Number of attempts to get a crop window that matches the ``aspect_ratio`` and -a selected value from ``thresholds``. + R"code(Number of attempts to get a crop window that matches the `aspect_ratio` and +a selected value from `thresholds`. -After each ``num_attempts``, a different threshold will be picked, until the threshold reaches -a maximum of ``total_num_attempts`` (if provided) or otherwise indefinitely.)code", +After each `num_attempts`, a different threshold will be picked, until the threshold reaches +a maximum of `total_num_attempts` (if provided) or otherwise indefinitely.)code", 1) .AddOptionalArg( "total_num_attempts", R"code(If provided, it indicates the total maximum number of attempts to get a crop -window that matches the ``aspect_ratio`` and any selected value from ``thresholds``. +window that matches the `aspect_ratio` and any selected value from `thresholds`. -After ``total_num_attempts`` attempts, the best candidate will be selected. +After `total_num_attempts` attempts, the best candidate will be selected. If this value is not specified, the crop search will continue indefinitely until a valid crop is found. .. warning:: - If you do not provide a ``total_num_attempts`` value, this can result in an infinite + If you do not provide a `total_num_attempts` value, this can result in an infinite loop if the conditions imposed by the arguments cannot be satisfied. )code", -1) .AddOptionalArg( "all_boxes_above_threshold", R"code(If set to True, all bounding boxes in a sample should overlap with the cropping -window as specified by ``thresholds``. +window as specified by `thresholds`. If the bounding boxes do not overlap, the cropping window is considered to be invalid. If set to False, and at least one bounding box overlaps the window, the window is considered to @@ -300,23 +300,23 @@ be valid.)code", .AddOptionalArg( "allow_no_crop", R"code(If set to True, one of the possible outcomes of the random process will -be to not crop, as if the outcome was one more ``thresholds`` value from which to choose.)code", +be to not crop, as if the outcome was one more `thresholds` value from which to choose.)code", true) .AddOptionalArg( "crop_shape", R"code(If provided, the random crop window dimensions will be fixed to this shape. -The order of dimensions is determined by the layout provided in ``shape_layout``. +The order of dimensions is determined by the layout provided in `shape_layout`. .. note:: - When providing ``crop_shape``, ``input_shape`` should be provided as well. Providing explicit ``crop_shape`` is - incompatible with using ``scaling`` and ``aspect_ratio`` arguments.)code", + When providing `crop_shape`, `input_shape` should be provided as well. Providing explicit `crop_shape` is + incompatible with using `scaling` and `aspect_ratio` arguments.)code", std::vector{}, true) .AddOptionalArg( "input_shape", R"code(Specifies the shape of the original input image. -The order of dimensions is determined by the layout that is provided in ``shape_layout``. +The order of dimensions is determined by the layout that is provided in `shape_layout`. )code", std::vector{}, true) .AddOptionalArg( @@ -336,8 +336,8 @@ The value of this argument is a string containing the following characters:: TensorLayout{}) .AddOptionalArg( "shape_layout", - R"code(Determines the meaning of the dimensions provided in ``crop_shape`` and -``input_shape``. + R"code(Determines the meaning of the dimensions provided in `crop_shape` and +`input_shape`. The values are: diff --git a/dali/operators/image/crop/crop_attr.cc b/dali/operators/image/crop/crop_attr.cc index 6a4003759d2..78c752d32d9 100644 --- a/dali/operators/image/crop/crop_attr.cc +++ b/dali/operators/image/crop/crop_attr.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2019-2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// Copyright (c) 2019-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -24,8 +24,8 @@ DALI_SCHEMA(CropAttr) "crop", R"code(Shape of the cropped image, specified as a list of values (for example, ``(crop_H, crop_W)`` for the 2D crop and ``(crop_D, crop_H, crop_W)`` for the volumetric crop). -Providing crop argument is incompatible with providing separate arguments such as ``crop_d``, -``crop_h``, and ``crop_w``.)code", +Providing crop argument is incompatible with providing separate arguments such as `crop_d`, +`crop_h`, and `crop_w`.)code", nullptr, true) .AddOptionalArg( "crop_pos_x", R"code(Normalized (0.0 - 1.0) horizontal position of the cropping window @@ -35,7 +35,7 @@ The actual position is calculated as ``crop_x = crop_x_norm * (W - crop_W)``, wh is the normalized position, ``W`` is the width of the image, and ``crop_W`` is the width of the cropping window. -See ``rounding`` argument for more details on how ``crop_x`` is converted to an integral value.)code", +See `rounding` argument for more details on how ``crop_x`` is converted to an integral value.)code", 0.5f, true) .AddOptionalArg( "crop_pos_y", R"code(Normalized (0.0 - 1.0) vertical position of the start of @@ -45,7 +45,7 @@ The actual position is calculated as ``crop_y = crop_y_norm * (H - crop_H)``, wh is the normalized position, `H` is the height of the image, and ``crop_H`` is the height of the cropping window. -See ``rounding`` argument for more details on how ``crop_y`` is converted to an integral value.)code", +See `rounding` argument for more details on how ``crop_y`` is converted to an integral value.)code", 0.5f, true) .AddOptionalArg( "crop_pos_z", R"code(Applies **only** to volumetric inputs. @@ -55,30 +55,30 @@ The actual position is calculated as ``crop_z = crop_z_norm * (D - crop_D)``, wh is the normalized position, ``D`` is the depth of the image and ``crop_D`` is the depth of the cropping window. -See ``rounding`` argument for more details on how ``crop_z`` is converted to an integral value.)code", +See `rounding` argument for more details on how ``crop_z`` is converted to an integral value.)code", 0.5f, true) .AddOptionalArg( "crop_w", R"code(Cropping window width (in pixels). -Providing values for ``crop_w`` and ``crop_h`` is incompatible with providing fixed crop window -dimensions (argument ``crop``).)code", +Providing values for `crop_w` and `crop_h` is incompatible with providing fixed crop window +dimensions (argument `crop`).)code", 0.0f, true) .AddOptionalArg( "crop_h", R"code(Cropping the window height (in pixels). -Providing values for ``crop_w`` and ``crop_h`` is incompatible with providing fixed crop -window dimensions (argument ``crop``).)code", +Providing values for `crop_w` and `crop_h` is incompatible with providing fixed crop +window dimensions (argument `crop`).)code", 0.0f, true) .AddOptionalArg( "crop_d", R"code(Applies **only** to volumetric inputs; cropping window depth (in voxels). -``crop_w``, ``crop_h``, and ``crop_d`` must be specified together. Providing values -for ``crop_w``, ``crop_h``, and ``crop_d`` is incompatible with providing the fixed crop +`crop_w`, `crop_h`, and `crop_d` must be specified together. Providing values +for `crop_w`, `crop_h`, and `crop_d` is incompatible with providing the fixed crop window dimensions (argument `crop`).)code", 0.0f, true) .AddOptionalArg( "rounding", R"code(Determines the rounding function used to convert the starting coordinate -of the window to an integral value (see ``crop_pos_x``, ``crop_pos_y``, ``crop_pos_z``). +of the window to an integral value (see `crop_pos_x`, `crop_pos_y`, `crop_pos_z`). Possible values are: diff --git a/dali/operators/image/crop/crop_mirror_normalize.cc b/dali/operators/image/crop/crop_mirror_normalize.cc index 4197c8f0d49..59645b2270d 100644 --- a/dali/operators/image/crop/crop_mirror_normalize.cc +++ b/dali/operators/image/crop/crop_mirror_normalize.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2019-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// Copyright (c) 2019-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -52,7 +52,7 @@ Supported types: ``FLOAT``, ``FLOAT16``, ``INT8``, ``UINT8``. .AddOptionalArg("pad_output", R"code(Determines whether to pad the output so that the number of channels is a power of 2. -The value used for padding is determined by the ``fill_values`` argument.)code", false) +The value used for padding is determined by the `fill_values` argument.)code", false) .AddOptionalArg("mirror", R"code(If nonzero, the image will be flipped (mirrored) horizontally.)code", 0, true) diff --git a/dali/operators/image/distortion/jpeg_compression_distortion_op_cpu.cc b/dali/operators/image/distortion/jpeg_compression_distortion_op_cpu.cc index cc6e0a991d6..531203511f1 100644 --- a/dali/operators/image/distortion/jpeg_compression_distortion_op_cpu.cc +++ b/dali/operators/image/distortion/jpeg_compression_distortion_op_cpu.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2021-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// Copyright (c) 2021-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -30,7 +30,7 @@ is applied independently to 8x8 pixel blocks, which introduces additional artifa at block boundaries. This operation produces images by subjecting the input to a transformation that -mimics JPEG compression with given ``quality`` factor followed by decompression. +mimics JPEG compression with given `quality` factor followed by decompression. )code") .NumInput(1) .InputLayout({"HWC", "FHWC"}) diff --git a/dali/operators/image/paste/paste.cc b/dali/operators/image/paste/paste.cc index df11be68411..d55a7a08b12 100644 --- a/dali/operators/image/paste/paste.cc +++ b/dali/operators/image/paste/paste.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved. +// Copyright (c) 2017-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -29,7 +29,7 @@ DALI_SCHEMA(Paste) .AddArg("fill_value", R"code(Tuple of the values of the color that is used to fill the canvas. -The length of the tuple must be equal to ``n_channels``.)code", +The length of the tuple must be equal to `n_channels`.)code", DALI_INT_VEC) .AddOptionalArg("paste_x", R"code(Horizontal position of the paste in (0.0 - 1.0) image coordinates.)code", diff --git a/dali/operators/image/remap/cvcuda/warp_perspective.cc b/dali/operators/image/remap/cvcuda/warp_perspective.cc index bc258b89e2d..a66b5198045 100644 --- a/dali/operators/image/remap/cvcuda/warp_perspective.cc +++ b/dali/operators/image/remap/cvcuda/warp_perspective.cc @@ -56,7 +56,7 @@ specify ``(480,640)``, not ``(480,640,3)``. If `inverse_map` argument is set to false, the matrix is interpreted as a source to destination coordinates mapping. -It is equivalent to OpenCV's ``warpPerspective`` operation with the ``inverse_map`` argument being +It is equivalent to OpenCV's ``warpPerspective`` operation with the `inverse_map` argument being analog to the ``WARP_INVERSE_MAP`` flag. .. note:: diff --git a/dali/operators/image/remap/jitter.cu b/dali/operators/image/remap/jitter.cu index 525a39a5529..662cae7d423 100644 --- a/dali/operators/image/remap/jitter.cu +++ b/dali/operators/image/remap/jitter.cu @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved. +// Copyright (c) 2017-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -22,7 +22,7 @@ DALI_SCHEMA(Jitter) .DocStr(R"code(Performs a random Jitter augmentation. The output images are produced by moving each pixel by a random amount, in the x and y dimensions, -and bounded by half of the ``nDegree`` parameter.)code") +and bounded by half of the `nDegree` parameter.)code") .NumInput(1) .NumOutput(1) .AddOptionalArg("nDegree", diff --git a/dali/operators/image/remap/rotate.cc b/dali/operators/image/remap/rotate.cc index 644699e332c..c5dccea472a 100644 --- a/dali/operators/image/remap/rotate.cc +++ b/dali/operators/image/remap/rotate.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2019-2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// Copyright (c) 2019-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -26,13 +26,13 @@ DALI_SCHEMA(Rotate) around which to rotate the image. The vector does not need to be normalized, but it must have a non-zero length. -Reversing the vector is equivalent to changing the sign of ``angle``. +Reversing the vector is equivalent to changing the sign of `angle`. )code", std::vector(), true, true) .AddArg("angle", R"code(Angle, in degrees, by which the image is rotated. For two-dimensional data, the rotation is counter-clockwise, assuming the top-left corner is -at ``(0,0)``. For three-dimensional data, the ``angle`` is a positive rotation around the provided +at ``(0,0)``. For three-dimensional data, the `angle` is a positive rotation around the provided axis.)code", DALI_FLOAT, true, true) .AddOptionalArg("keep_size", R"code(If True, original canvas size is kept. diff --git a/dali/operators/image/remap/warp_affine.cc b/dali/operators/image/remap/warp_affine.cc index ff9921dcb58..4334d0a7c4c 100644 --- a/dali/operators/image/remap/warp_affine.cc +++ b/dali/operators/image/remap/warp_affine.cc @@ -23,7 +23,7 @@ DALI_SCHEMA(WarpAffine) .NumInput(1, 2) .InputDox(0, "data", "TensorList", "The image or volume to be warped") .InputDox(1, "mtx", "TensorList of float", - "Like ``matrix`` argument, but can be placed in GPU memory") + "Like `matrix` argument, but can be placed in GPU memory") .NumOutput(1) .InputLayout(0, { "HWC", "FHWC", "DHWC", "FDHWC" }) .InputDevice(1, InputDevice::MatchBackendOrCPU) @@ -31,7 +31,7 @@ DALI_SCHEMA(WarpAffine) .AddOptionalArg("matrix", R"code(Transform matrix. -When the ``inverse_map`` option is set to true (default), the matrix represents a destination to source mapping. +When the `inverse_map` option is set to true (default), the matrix represents a destination to source mapping. With a list of values ``(M11, M12, M13, M21, M22, M23)``, this operation produces a new image by using the following formula:: @@ -39,10 +39,10 @@ by using the following formula:: Where ``[0, 0]`` coordinate means the corner of the first pixel. -If the ``inverse_map`` option is set to false, the matrix represents a source to destination +If the `inverse_map` option is set to false, the matrix represents a source to destination transform and it is inverted before applying the formula above. -It is equivalent to OpenCV's ``warpAffine`` operation with the ``inverse_map`` argument being +It is equivalent to OpenCV's ``warpAffine`` operation with the `inverse_map` argument being analog to the ``WARP_INVERSE_MAP`` flag. .. note:: diff --git a/dali/operators/image/resize/resampling_attr.cc b/dali/operators/image/resize/resampling_attr.cc index cb6eb55ca39..5143538e524 100644 --- a/dali/operators/image/resize/resampling_attr.cc +++ b/dali/operators/image/resize/resampling_attr.cc @@ -24,11 +24,11 @@ DALI_SCHEMA(ResamplingFilterAttr) .AddOptionalArg("interp_type", R"code(Type of interpolation to be used. -Use ``min_filter`` and ``mag_filter`` to specify different filtering for downscaling and upscaling. +Use `min_filter` and `mag_filter` to specify different filtering for downscaling and upscaling. .. note:: Usage of INTERP_TRIANGULAR is now deprecated and it should be replaced by a combination of -INTERP_LINEAR with ``antialias`` enabled. +INTERP_LINEAR with `antialias` enabled. )code", DALI_INTERP_LINEAR, true) .AddOptionalArg("mag_filter", "Filter used when scaling up.", diff --git a/dali/operators/image/resize/resize_attr.cc b/dali/operators/image/resize/resize_attr.cc index 4d29c736043..cc1692f88b3 100644 --- a/dali/operators/image/resize/resize_attr.cc +++ b/dali/operators/image/resize/resize_attr.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2020-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// Copyright (c) 2020-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -24,34 +24,34 @@ namespace dali { DALI_SCHEMA(ResizeAttr) .AddOptionalArg("resize_x", R"code(The length of the X dimension of the resized image. -This option is mutually exclusive with ``resize_shorter``, ``resize_longer`` and ``size``. -If the ``resize_y`` is unspecified or 0, the operator keeps the aspect ratio of the original image. +This option is mutually exclusive with `resize_shorter`, `resize_longer` and `size`. +If the `resize_y` is unspecified or 0, the operator keeps the aspect ratio of the original image. A negative value flips the image.)code", 0.f, true) .AddOptionalArg("resize_y", R"code(The length of the Y dimension of the resized image. -This option is mutually exclusive with ``resize_shorter``, ``resize_longer`` and ``size``. -If the ``resize_x`` is unspecified or 0, the operator keeps the aspect ratio of the original image. +This option is mutually exclusive with `resize_shorter`, `resize_longer` and `size`. +If the `resize_x` is unspecified or 0, the operator keeps the aspect ratio of the original image. A negative value flips the image.)code", 0.f, true) .AddOptionalArg("resize_z", R"code(The length of the Z dimension of the resized volume. -This option is mutually exclusive with ``resize_shorter``, ``resize_longer`` and ``size``. -If the ``resize_x`` and ``resize_y`` are left unspecified or 0, then the op will keep +This option is mutually exclusive with `resize_shorter`, `resize_longer` and `size`. +If the `resize_x` and `resize_y` are left unspecified or 0, then the op will keep the aspect ratio of the original volume. Negative value flips the volume.)code", 0.f, true) .AddOptionalArg>("size", R"code(The desired output size. Must be a list/tuple with one entry per spatial dimension, excluding video frames and channels. Dimensions with a 0 extent are treated as absent, and the output size will be calculated based on -other extents and ``mode`` argument.)code", {}, true) +other extents and `mode` argument.)code", {}, true) .AddOptionalArg("resize_shorter", R"code(The length of the shorter dimension of the resized image. -This option is mutually exclusive with ``resize_longer`` and explicit size arguments, and +This option is mutually exclusive with `resize_longer` and explicit size arguments, and the operator keeps the aspect ratio of the original image. This option is equivalent to specifying the same size for all dimensions and ``mode="not_smaller"``. -The longer dimension can be bounded by setting the ``max_size`` argument. -See ``max_size`` argument doc for more info.)code", 0.f, true) +The longer dimension can be bounded by setting the `max_size` argument. +See `max_size` argument doc for more info.)code", 0.f, true) .AddOptionalArg("resize_longer", R"code(The length of the longer dimension of the resized image. -This option is mutually exclusive with ``resize_shorter`` and explicit size arguments, and +This option is mutually exclusive with `resize_shorter` and explicit size arguments, and the operator keeps the aspect ratio of the original image. This option is equivalent to specifying the same size for all dimensions and ``mode="not_larger"``. )code", 0.f, true) diff --git a/dali/operators/image/resize/resize_attr_base.cc b/dali/operators/image/resize/resize_attr_base.cc index 8d678d8b6e9..28bc0324504 100644 --- a/dali/operators/image/resize/resize_attr_base.cc +++ b/dali/operators/image/resize/resize_attr_base.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2020-2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// Copyright (c) 2020-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -39,7 +39,7 @@ DALI_SCHEMA(ResizeAttrBase) | For example, a 640x480 image with a desired output size of 1920x1080, actually produces a 1920x1440 output. - This argument is mutually exclusive with ``resize_longer`` and ``resize_shorter``)code", + This argument is mutually exclusive with `resize_longer` and `resize_shorter`)code", "default") .AddOptionalArg("subpixel_scale", R"code(If True, fractional sizes, directly specified or calculated, will cause the input ROI to be adjusted to keep the scale factor. @@ -49,15 +49,15 @@ the rounded output size.)code", true) .AddOptionalArg>("roi_start", R"code(Origin of the input region of interest (ROI). -Must be specified together with ``roi_end``. The coordinates follow the tensor shape order, which is -the same as ``size``. The coordinates can be either absolute (in pixels, which is the default) or +Must be specified together with `roi_end`. The coordinates follow the tensor shape order, which is +the same as `size`. The coordinates can be either absolute (in pixels, which is the default) or relative (0..1), depending on the value of ``relative_roi`` argument. If the ROI origin is greater than the ROI end in any dimension, the region is flipped in that dimension.)code", nullptr, true) .AddOptionalArg>("roi_end", R"code(End of the input region of interest (ROI). -Must be specified together with ``roi_start``. The coordinates follow the tensor shape order, which is -the same as ``size``. The coordinates can be either absolute (in pixels, which is the default) or +Must be specified together with `roi_start`. The coordinates follow the tensor shape order, which is +the same as `size`. The coordinates can be either absolute (in pixels, which is the default) or relative (0..1), depending on the value of ``relative_roi`` argument. If the ROI origin is greater than the ROI end in any dimension, the region is flipped in that dimension.)code", nullptr, true) @@ -67,14 +67,14 @@ where 0 denotes top/left and 1 denotes bottom/right)code", .AddOptionalArg>("max_size", R"code(Limit of the output size. When the operator is configured to keep aspect ratio and only the smaller dimension is specified, -the other(s) can grow very large. This can happen when using ``resize_shorter`` argument +the other(s) can grow very large. This can happen when using `resize_shorter` argument or "not_smaller" mode or when some extents are left unspecified. This parameter puts a limit to how big the output can become. This value can be specified per-axis or uniformly for all axes. .. note:: - When used with "not_smaller" mode or ``resize_shorter`` argument, ``max_size`` takes + When used with "not_smaller" mode or `resize_shorter` argument, `max_size` takes precedence and the aspect ratio is kept - for example, resizing with ``mode="not_smaller", size=800, max_size=1400`` an image of size 1200x600 would be resized to 1400x700. diff --git a/dali/operators/image/resize/resize_crop_mirror.cc b/dali/operators/image/resize/resize_crop_mirror.cc index 81905f5f50d..20d94689e79 100755 --- a/dali/operators/image/resize/resize_crop_mirror.cc +++ b/dali/operators/image/resize/resize_crop_mirror.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// Copyright (c) 2017-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -33,7 +33,7 @@ Supported values: DALI_SCHEMA(ResizeCropMirror) .DocStr(R"(Performs a fused resize, crop, mirror operation. -The result of the operation is equivalent to applying ``resize``, followed by ``crop`` and ``flip``. +The result of the operation is equivalent to applying ``resize``, followed by `crop` and ``flip``. Internally, the operator calculates the relevant region of interest and performs a single resizing operation on that region. .)") diff --git a/dali/operators/image/resize/tensor_resize_attr.cc b/dali/operators/image/resize/tensor_resize_attr.cc index f1fe2031273..314995609f4 100644 --- a/dali/operators/image/resize/tensor_resize_attr.cc +++ b/dali/operators/image/resize/tensor_resize_attr.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// Copyright (c) 2022-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -26,17 +26,17 @@ namespace dali { DALI_SCHEMA(TensorResizeAttr) .AddOptionalArg>("sizes", R"code(Output sizes. -When ``axes`` is provided, the size values refer to the axes specified. -Note: Arguments ``sizes`` and ``scales`` are mutually exclusive.)code", +When `axes` is provided, the size values refer to the axes specified. +Note: Arguments `sizes` and `scales` are mutually exclusive.)code", {}, true) .AddOptionalArg>("scales", R"code(Scale factors. The resulting output size is calculated as ``out_size = size_rounding(scale_factor * original_size)``. -See ``size_rounding`` for a list of supported rounding policies. +See `size_rounding` for a list of supported rounding policies. -When ``axes`` is provided, the scale factor values refer to the axes specified. -Note: Arguments ``sizes`` and ``scales`` are mutually exclusive.)code", +When `axes` is provided, the scale factor values refer to the axes specified. +Note: Arguments `sizes` and `scales` are mutually exclusive.)code", {}, true) .AddOptionalArg("alignment", R"code(Determines the position of the ROI when using scales (provided or calculated). @@ -62,13 +62,13 @@ sizes/scales. If only one value is provided, it is applied to all dimensions.)co Accepted range is [-ndim, ndim-1]. Negative indices are counted from the back. -By default, all dimensions are assumed. The ``axis_names`` and ``axes`` arguments are mutually exclusive.)code", +By default, all dimensions are assumed. The `axis_names` and `axes` arguments are mutually exclusive.)code", nullptr) .AddOptionalArg( "axis_names", R"code(Names of the axes that `sizes`, `scales`, `max_size`, `roi_start`, `roi_end` refer to. -By default, all dimensions are assumed. The ``axis_names`` and ``axes`` arguments are mutually exclusive.)code", +By default, all dimensions are assumed. The `axis_names` and `axes` arguments are mutually exclusive.)code", nullptr) .AddOptionalArg("size_rounding", R"code(Determines the rounding policy when using scales. diff --git a/dali/operators/imgcodec/decoder_schema.cc b/dali/operators/imgcodec/decoder_schema.cc index ddd64050aa3..c9779c398d3 100644 --- a/dali/operators/imgcodec/decoder_schema.cc +++ b/dali/operators/imgcodec/decoder_schema.cc @@ -111,7 +111,7 @@ If set to True, each thread in the internal thread pool will be tied to a specif Otherwise, the threads can be reassigned to any CPU core by the operating system.)code", true) .AddOptionalArg("use_fast_idct", - R"code(Enables fast IDCT in the libjpeg-turbo based CPU decoder, used when ``device`` is set + R"code(Enables fast IDCT in the libjpeg-turbo based CPU decoder, used when `device` is set to "cpu" or when the it is set to "mixed" but the particular image can not be handled by the GPU implementation. @@ -206,23 +206,23 @@ and shape of the slice. Both coordinates and shapes can be provided in absolute The slice arguments can be specified by the following named arguments: -#. ``start``: Slice start coordinates (absolute) -#. ``rel_start``: Slice start coordinates (relative) -#. ``end``: Slice end coordinates (absolute) -#. ``rel_end``: Slice end coordinates (relative) -#. ``shape``: Slice shape (absolute) -#. ``rel_shape``: Slice shape (relative) +#. `start`: Slice start coordinates (absolute) +#. `rel_start`: Slice start coordinates (relative) +#. `end`: Slice end coordinates (absolute) +#. `rel_end`: Slice end coordinates (relative) +#. `shape`: Slice shape (absolute) +#. `rel_shape`: Slice shape (relative) The slice can be configured by providing start and end coordinates or start and shape. -Relative and absolute arguments can be mixed (for example, ``rel_start`` can be used with ``shape``) +Relative and absolute arguments can be mixed (for example, `rel_start` can be used with `shape`) as long as start and shape or end are uniquely defined. -Alternatively, two extra positional inputs can be provided, specifying ``anchor`` and ``shape``. -When using positional inputs, two extra boolean arguments ``normalized_anchor``/``normalized_shape`` +Alternatively, two extra positional inputs can be provided, specifying ``anchor`` and `shape`. +When using positional inputs, two extra boolean arguments `normalized_anchor`/`normalized_shape` can be used to specify the nature of the arguments provided. Using positional inputs for anchor and shape is incompatible with the named arguments specified above. -The slice arguments should provide as many dimensions as specified by the ``axis_names`` or ``axes`` +The slice arguments should provide as many dimensions as specified by the `axis_names` or `axes` arguments. By default, the :meth:`nvidia.dali.fn.decoders.image_slice` operator uses normalized coordinates @@ -252,14 +252,14 @@ point of the slice (x0, x1, x2, …). Integer coordinates are interpreted as absolute coordinates, while float coordinates can be interpreted as absolute or relative coordinates, depending on the value of -``normalized_anchor``.)code") +`normalized_anchor`.)code") .InputDox(2, "shape", "1D TensorList of float or int", R"code(Input that contains normalized or absolute coordinates for the dimensions of the slice (s0, s1, s2, …). Integer coordinates are interpreted as absolute coordinates, while float coordinates can be interpreted as absolute or relative coordinates, depending on the value of -``normalized_shape``.)code"); +`normalized_shape`.)code"); DALI_SCHEMA(experimental__decoders__ImageRandomCrop) @@ -272,7 +272,7 @@ The output of the decoder is in *HWC* layout. The implementation uses NVIDIA nvImageCodec to decode images. The cropping window's area (relative to the entire image) and aspect ratio can be restricted to -a range of values specified by ``area`` and ``aspect_ratio`` arguments, respectively. +a range of values specified by ``area`` and `aspect_ratio` arguments. respectively. When possible, the operator uses the ROI decoding, reducing the decoding time and memory consumption. diff --git a/dali/operators/input/video_input_cpu.cc b/dali/operators/input/video_input_cpu.cc index 4baf4df22cd..1efbdda408e 100644 --- a/dali/operators/input/video_input_cpu.cc +++ b/dali/operators/input/video_input_cpu.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// Copyright (c) 2022-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -55,7 +55,7 @@ batches of sequences. Every output batch will have the ``max_batch_size`` sample the Pipeline creation. When the number of frames in the video file does not allow to split the frames uniformly across batches, the last batch returned by this operator for a given video will be partial and the last sequence in this batch will be determined using -``last_sequence_policy`` parameter. For example:: +`last_sequence_policy` parameter. For example:: This is a video that consists of 67 frames (every '-' is a frame): diff --git a/dali/operators/math/normalize/normalize.cc b/dali/operators/math/normalize/normalize.cc index f221c678790..74e1c77819c 100644 --- a/dali/operators/math/normalize/normalize.cc +++ b/dali/operators/math/normalize/normalize.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2020-2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// Copyright (c) 2020-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -25,7 +25,7 @@ DALI_SCHEMA(Normalize) .DocStr(R"code(Normalizes the input by removing the mean and dividing by the standard deviation. The mean and standard deviation can be calculated internally for the specified subset -of axes or can be externally provided as the ``mean`` and ``stddev`` arguments. +of axes or can be externally provided as the `mean` and `stddev` arguments. The normalization is done following the formula:: @@ -37,9 +37,9 @@ be either tensors of same shape, scalars, or a mix of these. .. note:: The expression follows the *numpy* broadcasting rules. -Sizes of the non-scalar ``mean`` and ``stddev`` must have an extent of 1, if given axis +Sizes of the non-scalar `mean` and `stddev` must have an extent of 1, if given axis is reduced, or match the corresponding extent of the input. A dimension is considered reduced -if it is listed in ``axes`` or ``axis_names``. If neither the ``axes`` nor the ``axis_names`` +if it is listed in `axes` or `axis_names`. If neither the `axes` nor the `axis_names` argument is present, the set of reduced axes is inferred by comparing the input shape to the shape of the mean/stddev arguments, but the set of reduced axes must be the same for all tensors in the batch. @@ -86,17 +86,17 @@ is set to True.)code", nullptr, true) .AddOptionalArg("stddev", R"code(Standard deviation value to scale the data. -See ``mean`` argument for more information about shape constraints. If a value is not specified, -the standard deviation is calculated from the input. A non-scalar ``stddev`` cannot be used when -``batch`` argument is set to True.)code", +See `mean` argument for more information about shape constraints. If a value is not specified, +the standard deviation is calculated from the input. A non-scalar `stddev` cannot be used when +`batch` argument is set to True.)code", nullptr, true) .AddOptionalArg("axes", R"code(Indices of dimensions along which the input is normalized. By default, all axes are used, and the axes can also be specified by name. -See ``axis_names`` for more information.)code", std::vector{}, false) +See `axis_names` for more information.)code", std::vector{}, false) .AddOptionalArg("axis_names", R"code(Names of the axes in the input. -Axis indices are taken from the input layout, and this argument cannot be used with ``axes``.)code", +Axis indices are taken from the input layout, and this argument cannot be used with `axes`.)code", "") .AddOptionalArg("shift", R"code(The value to which the mean will map in the output. @@ -115,8 +115,8 @@ The variance is estimated by using the following formula:: This argument is ignored when an externally supplied standard deviation is used.)code", 0, false) .AddOptionalTypeArg("dtype", R"code(Output data type. -When using integral types, use ``shift`` and ``scale`` to improve the usage of the output -type's dynamic range. If ``dtype`` is an integral type, out of range values are clamped, +When using integral types, use `shift` and `scale` to improve the usage of the output +type's dynamic range. If `dtype` is an integral type, out of range values are clamped, and non-integer values are rounded to nearest integer.)code", DALI_FLOAT); template <> diff --git a/dali/operators/numba_function/numba_func.cc b/dali/operators/numba_function/numba_func.cc index fcb2d94351a..08da9ac4fab 100644 --- a/dali/operators/numba_function/numba_func.cc +++ b/dali/operators/numba_function/numba_func.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2021-2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// Copyright (c) 2021-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -50,7 +50,7 @@ If no setup function provided, the output shape and data type will be the same a .. warning:: When the pipeline has conditional execution enabled, additional steps must be taken to - prevent the ``run_fn`` and ``setup_fn`` functions from being rewritten by AutoGraph. + prevent the `run_fn` and `setup_fn` functions from being rewritten by AutoGraph. There are two ways to achieve this: 1. Define the functions at global scope (i.e. outside of ``pipeline_def`` scope). @@ -88,7 +88,7 @@ Also lets provide run function: for j in range(in0.shape[1]): out0[j, i] = in0[i, j] -The run function can work per-sample or per-batch, depending on the ``batch_processing`` argument. +The run function can work per-sample or per-batch, depending on the `batch_processing` argument. A run function working per-batch may look like this: @@ -132,7 +132,7 @@ This function is invoked once per batch. Also this function must work in Numba ` .AddOptionalArg("batch_processing", R"code(Determines whether the function is invoked once per batch or separately for each sample in the batch. -When ``batch_processing`` is set to ``True``, the function processes the whole batch. It is necessary if the +When `batch_processing` is set to ``True``, the function processes the whole batch. It is necessary if the function has to perform cross-sample operations and may be beneficial if significant part of the work can be reused. For other use cases, specifying False and using per-sample processing function allows the operator to process samples in parallel.)code", false); diff --git a/dali/operators/python_function/dltensor_function.cc b/dali/operators/python_function/dltensor_function.cc index 6dae7ea2af3..244345ed89e 100644 --- a/dali/operators/python_function/dltensor_function.cc +++ b/dali/operators/python_function/dltensor_function.cc @@ -47,10 +47,10 @@ The function should not modify input tensors. For the GPU operator, it is the user's responsibility to synchronize the device code with DALI. To synchronize the device code with DALI, synchronize DALI's work before the operator call -with the ``synchronize_stream`` flag (enabled by default) and ensure that the scheduled device +with the `synchronize_stream` flag (enabled by default) and ensure that the scheduled device tasks are finished in the operator call. The GPU code can be executed on the CUDA stream used by DALI, which can be obtained by calling the ``current_dali_stream()`` function. In this case, -the ``synchronize_stream`` flag can be set to False. +the `synchronize_stream` flag can be set to False. .. warning:: This operator is not compatible with TensorFlow integration. diff --git a/dali/operators/python_function/python_function.cc b/dali/operators/python_function/python_function.cc index 255bd32d18f..1661457f39f 100644 --- a/dali/operators/python_function/python_function.cc +++ b/dali/operators/python_function/python_function.cc @@ -49,7 +49,7 @@ The function should not modify input tensors. .. warning:: When the pipeline has conditional execution enabled, additional steps must be taken to - prevent the ``function`` from being rewritten by AutoGraph. + prevent the `function` from being rewritten by AutoGraph. There are two ways to achieve this: 1. Define the function at global scope (i.e. outside of ``pipeline_def`` scope). diff --git a/dali/operators/random/beta_distribution_cpu.cc b/dali/operators/random/beta_distribution_cpu.cc index 16c1d245ec0..e78af9140a7 100644 --- a/dali/operators/random/beta_distribution_cpu.cc +++ b/dali/operators/random/beta_distribution_cpu.cc @@ -31,8 +31,8 @@ where ``Г`` is the gamma function defined as: The operator supports ``float32`` and ``float64`` output types. -The shape of the generated data can be either specified explicitly with a ``shape`` argument, -or chosen to match the shape of the ``__shape_like`` input, if provided. If none are present, +The shape of the generated data can be either specified explicitly with a `shape` argument, +or chosen to match the shape of the `__shape_like` input, if provided. If none are present, a single value per sample is generated. )code") .NumInput(0, 1) diff --git a/dali/operators/random/choice_cpu.cc b/dali/operators/random/choice_cpu.cc index d9966552062..c873fdee998 100644 --- a/dali/operators/random/choice_cpu.cc +++ b/dali/operators/random/choice_cpu.cc @@ -23,10 +23,10 @@ DALI_SCHEMA(random__Choice) .DocStr(R"code(Generates a random sample from a given 1D array. The probability of selecting a sample from the input is determined by the corresponding probability -specified in ``p`` argument. +specified in `p` argument. -The shape of the generated data can be either specified explicitly with a ``shape`` argument, -or chosen to match the shape of the ``__shape_like`` input, if provided. If none are present, +The shape of the generated data can be either specified explicitly with a `shape` argument, +or chosen to match the shape of the `__shape_like` input, if provided. If none are present, a single value per sample is generated. The type of the output matches the type of the input. @@ -37,9 +37,9 @@ that is: :meth:`nvidia.dali.types.DALIDataType`, :meth:`nvidia.dali.types.DALIIm )code") .NumInput(1, 2) .InputDox(0, "a", "scalar or TensorList", - "If a scalar value ``__a`` is provided, the operator behaves as if " + "If a scalar value `__a` is provided, the operator behaves as if " "``[0, 1, ..., __a-1]`` list was passed as input. " - "Otherwise ``__a`` is treated as 1D array of input samples.") + "Otherwise `__a` is treated as 1D array of input samples.") .InputDox(1, "shape_like", "TensorList", "Shape of this input will be used to infer the shape of the output, if provided.") .InputDevice(1, InputDevice::Metadata) diff --git a/dali/operators/random/coin_flip_cpu.cc b/dali/operators/random/coin_flip_cpu.cc index 1012d194669..31c6842f06e 100644 --- a/dali/operators/random/coin_flip_cpu.cc +++ b/dali/operators/random/coin_flip_cpu.cc @@ -21,10 +21,10 @@ namespace dali { DALI_SCHEMA(random__CoinFlip) .DocStr(R"code(Generates random boolean values following a bernoulli distribution. -The probability of generating a value 1 (true) is determined by the ``probability`` argument. +The probability of generating a value 1 (true) is determined by the `probability` argument. -The shape of the generated data can be either specified explicitly with a ``shape`` argument, -or chosen to match the shape of the ``__shape_like`` input, if provided. If none are present, +The shape of the generated data can be either specified explicitly with a `shape` argument, +or chosen to match the shape of the `__shape_like` input, if provided. If none are present, a single value per sample is generated. )code") .NumInput(0, 1) @@ -43,9 +43,9 @@ DALI_REGISTER_OPERATOR(random__CoinFlip, CoinFlip, CPU); DALI_SCHEMA(CoinFlip) .DocStr(R"code(Generates random boolean values following a bernoulli distribution. -The probability of generating a value 1 (true) is determined by the ``probability`` argument. +The probability of generating a value 1 (true) is determined by the `probability` argument. -The shape of the generated data can be either specified explicitly with a ``shape`` argument, +The shape of the generated data can be either specified explicitly with a `shape` argument, or chosen to match the shape of the input, if provided. If none are present, a single value per sample is generated. )code") diff --git a/dali/operators/random/noise/shot_noise.cc b/dali/operators/random/noise/shot_noise.cc index 93ad8aa24fa..09932a03eda 100644 --- a/dali/operators/random/noise/shot_noise.cc +++ b/dali/operators/random/noise/shot_noise.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved. +// Copyright (c) 2021-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -31,11 +31,11 @@ where ``poisson_dist`` represents a poisson distribution. Shot noise is a noise that's present in data generated by a Poisson process, like registering photons by an image sensor. This operator simulates the data acquisition process where each event increases the output value by -``factor`` and the input tensor contains the expected values of corresponding -output points. For example, a ``factor`` of 0.1 means that 10 events are +`factor` and the input tensor contains the expected values of corresponding +output points. For example, a `factor` of 0.1 means that 10 events are needed to increase the output value by 1, while a factor of 10 means that a single event increases the output by 10. The output values are quantized -to multiples of ``factor``. The larger the factor, the more noise is present in +to multiples of `factor`. The larger the factor, the more noise is present in the output. A factor of 0 makes this an identity operation. The shape and data type of the output will match the input. diff --git a/dali/operators/random/normal_distribution_cpu.cc b/dali/operators/random/normal_distribution_cpu.cc index 48d1ca87d94..8cf75a9904e 100644 --- a/dali/operators/random/normal_distribution_cpu.cc +++ b/dali/operators/random/normal_distribution_cpu.cc @@ -21,8 +21,8 @@ namespace dali { DALI_SCHEMA(random__Normal) .DocStr(R"code(Generates random numbers following a normal distribution. -The shape of the generated data can be either specified explicitly with a ``shape`` argument, -or chosen to match the shape of the ``__shape_like`` input, if provided. If none are present, +The shape of the generated data can be either specified explicitly with a `shape` argument, +or chosen to match the shape of the `__shape_like` input, if provided. If none are present, a single value per sample is generated. )code") .NumInput(0, 1) @@ -44,8 +44,8 @@ DALI_REGISTER_OPERATOR(random__Normal, NormalDistribution, CPU); DALI_SCHEMA(NormalDistribution) .DocStr(R"code(Generates random numbers following a normal distribution. -The shape of the generated data can be either specified explicitly with a ``shape`` argument, -or chosen to match the shape of the ``__shape_like`` input, if provided. If none are present, +The shape of the generated data can be either specified explicitly with a `shape` argument, +or chosen to match the shape of the `__shape_like` input, if provided. If none are present, a single value per sample is generated. )code") .NumInput(0, 1) diff --git a/dali/operators/random/uniform_distribution_cpu.cc b/dali/operators/random/uniform_distribution_cpu.cc index 91c6ca40bf9..42d1a568a64 100644 --- a/dali/operators/random/uniform_distribution_cpu.cc +++ b/dali/operators/random/uniform_distribution_cpu.cc @@ -21,12 +21,12 @@ namespace dali { DALI_SCHEMA(random__Uniform) .DocStr(R"code(Generates random numbers following a uniform distribution. -It can be configured to produce a continuous uniform distribution in the ``range`` [min, max), -or a discrete uniform distribution where any of the specified ``values`` [v0, v1, ..., vn] occur +It can be configured to produce a continuous uniform distribution in the `range` [min, max), +or a discrete uniform distribution where any of the specified `values` [v0, v1, ..., vn] occur with equal probability. -The shape of the generated data can be either specified explicitly with a ``shape`` argument, -or chosen to match the shape of the ``__shape_like`` input, if provided. If none are present, +The shape of the generated data can be either specified explicitly with a `shape` argument, +or chosen to match the shape of the `__shape_like` input, if provided. If none are present, a single value per sample is generated. )code") .NumInput(0, 1) @@ -37,17 +37,17 @@ a single value per sample is generated. .AddOptionalArg("range", R"code(Range ``[min, max)`` of a continuous uniform distribution. -This argument is mutually exclusive with ``values``. +This argument is mutually exclusive with `values`. .. warning:: - When specifying an integer type as ``dtype``, the generated numbers can go outside + When specifying an integer type as `dtype`, the generated numbers can go outside the specified range, due to rounding. )code", std::vector{-1.0f, 1.0f}, true) .AddOptionalArg>("values", R"code(The discrete values [v0, v1, ..., vn] produced by a discrete uniform distribution. -This argument is mutually exclusive with ``range``.)code", +This argument is mutually exclusive with `range`.)code", nullptr, true) .AddParent("RNGAttr"); @@ -57,12 +57,12 @@ DALI_REGISTER_OPERATOR(random__Uniform, UniformDistribution, CPU); DALI_SCHEMA(Uniform) .DocStr(R"code(Generates random numbers following a uniform distribution. -It can be configured to produce a continuous uniform distribution in the ``range`` [min, max), -or a discrete uniform distribution where any of the specified ``values`` [v0, v1, ..., vn] occur +It can be configured to produce a continuous uniform distribution in the `range` [min, max), +or a discrete uniform distribution where any of the specified `values` [v0, v1, ..., vn] occur with equal probability. -The shape of the generated data can be either specified explicitly with a ``shape`` argument, -or chosen to match the shape of the ``__shape_like`` input, if provided. If none are present, +The shape of the generated data can be either specified explicitly with a `shape` argument, +or chosen to match the shape of the `__shape_like` input, if provided. If none are present, a single value per sample is generated. )code") .NumInput(0, 1) @@ -73,17 +73,17 @@ a single value per sample is generated. .AddOptionalArg("range", R"code(Range ``[min, max)`` of a continuous uniform distribution. -This argument is mutually exclusive with ``values``. +This argument is mutually exclusive with `values`. .. warning:: - When specifying an integer type as ``dtype``, the generated numbers can go outside + When specifying an integer type as `dtype`, the generated numbers can go outside the specified range, due to rounding. )code", std::vector{-1.0f, 1.0f}, true) .AddOptionalArg>("values", R"code(The discrete values [v0, v1, ..., vn] produced by a discrete uniform distribution. -This argument is mutually exclusive with ``range``.)code", +This argument is mutually exclusive with `range`.)code", nullptr, true) .AddParent("RNGAttr") .Deprecate("random__Uniform"); // Deprecated in 0.30 diff --git a/dali/operators/reader/coco_reader_op.cc b/dali/operators/reader/coco_reader_op.cc index a3e513d35e5..3f1787ad4dd 100755 --- a/dali/operators/reader/coco_reader_op.cc +++ b/dali/operators/reader/coco_reader_op.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// Copyright (c) 2017-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -54,14 +54,14 @@ This readers produces the following outputs:: ... [x_M, y_M, w_M, h_M]] - or in ``[l, t, r, b]`` format if requested (see ``ltrb`` argument). + or in ``[l, t, r, b]`` format if requested (see `ltrb` argument). * **labels** Each bounding box is associated with an integer label representing a category identifier:: [label_0, label_1, ..., label_M] -* **polygons** and **vertices** (Optional, present if ``polygon_masks`` is set to True) - If ``polygon_masks`` is enabled, two extra outputs describing masks by a set of polygons. +* **polygons** and **vertices** (Optional, present if `polygon_masks` is set to True) + If `polygon_masks` is enabled, two extra outputs describing masks by a set of polygons. Each mask contains an arbitrary number of polygons ``P``, each associated with a mask index in the range [0, M) and composed by a group of ``V`` vertices. The output ``polygons`` describes the polygons as follows:: @@ -79,9 +79,9 @@ This readers produces the following outputs:: ... [x_V, y_V]] -* **pixelwise_masks** (Optional, present if argument ``pixelwise_masks`` is set to True) - Contains image-like data, same shape and layout as ``images``, representing a pixelwise segmentation mask. -* **image_ids** (Optional, present if argument ``image_ids`` is set to True) +* **pixelwise_masks** (Optional, present if argument `pixelwise_masks` is set to True) + Contains image-like data, same shape and layout as `images`, representing a pixelwise segmentation mask. +* **image_ids** (Optional, present if argument `image_ids` is set to True) One element per sample, representing an image identifier.)code") .AddOptionalArg("preprocessed_annotations", "Path to the directory with meta files that contain preprocessed COCO annotations.", @@ -108,17 +108,17 @@ If set to False, the bboxes are returned as [x, y, width, height].)code", true) .AddOptionalArg("polygon_masks", R"code(If set to True, segmentation mask polygons are read in the form of two outputs: -``polygons`` and ``vertices``. This argument is mutually exclusive with ``pixelwise_masks``.)code", +``polygons`` and ``vertices``. This argument is mutually exclusive with `pixelwise_masks`.)code", false) .AddOptionalArg("masks", R"code(Enable polygon masks.)code", false) .DeprecateArg("masks", false, -R"code(Use ``polygon_masks`` instead. Note that the polygon format has changed ``mask_id, start_coord, end_coord`` to ``mask_id, start_vertex, end_vertex`` where +R"code(Use `polygon_masks` instead. Note that the polygon format has changed ``mask_id, start_coord, end_coord`` to ``mask_id, start_vertex, end_vertex`` where start_coord and end_coord are total number of coordinates, effectly ``start_coord = 2 * start_vertex`` and ``end_coord = 2 * end_vertex``. Example: A polygon with vertices ``[[x0, y0], [x1, y1], [x2, y2]]`` would be represented as ``[mask_id, 0, 6]`` when using the deprecated -argument ``masks``, but ``[mask_id, 0, 3]`` when using the new argument ``polygon_masks``.)code") // deprecated since 0.28dev +argument ``masks``, but ``[mask_id, 0, 3]`` when using the new argument `polygon_masks`.)code") // deprecated since 0.28dev .AddOptionalArg("pixelwise_masks", R"code(If true, segmentation masks are read and returned as pixel-wise masks. This argument is -mutually exclusive with ``polygon_masks``.)code", +mutually exclusive with `polygon_masks`.)code", false) .AddOptionalArg("skip_empty", R"code(If true, reader will skip samples with no object instances in them)code", @@ -151,7 +151,7 @@ ordered by their image id. The paths to be kept should match exactly those in the annotations file. -Note: This argument is mutually exclusive with ``preprocessed_annotations``.)code", nullptr) +Note: This argument is mutually exclusive with `preprocessed_annotations`.)code", nullptr) .DeprecateArgInFavorOf("save_img_ids", "image_ids") // deprecated since 0.28dev .AddOptionalArg("save_preprocessed_annotations", R"code(If set to True, the operator saves a set of files containing binary representations of the diff --git a/dali/operators/reader/file_reader_op.cc b/dali/operators/reader/file_reader_op.cc index 3d52e1ee07e..7825da921ce 100644 --- a/dali/operators/reader/file_reader_op.cc +++ b/dali/operators/reader/file_reader_op.cc @@ -28,11 +28,11 @@ This operator can be used in the following modes: 1. Listing files from a directory, assigning labels based on subdirectory structure. -In this mode, the directory indicated in ``file_root`` argument should contain one or more +In this mode, the directory indicated in `file_root` argument should contain one or more subdirectories. The files in these subdirectories are listed and assigned labels based on -lexicographical order of the subdirectory. If you provide ``file_filters`` argument with +lexicographical order of the subdirectory. If you provide `file_filters` argument with a list of glob strings, the operator will list files matching at least one of the patterns. -Otherwise, a default set of filters is used (see the default value of ``file_filters`` for +Otherwise, a default set of filters is used (see the default value of `file_filters` for details). For example, this directory structure:: @@ -64,7 +64,7 @@ and with ``file_filters = ["*.jpg", "*.jpeg"]`` will yield the following outputs 2. Use file names and labels stored in a text file. -``file_list`` argument points to a file which contains one file name and label per line. +`file_list` argument points to a file which contains one file name and label per line. Example:: dog.jpg 0 @@ -84,40 +84,40 @@ for details. .AddOptionalArg("file_root", R"(Path to a directory that contains the data files. -If not using ``file_list`` or ``files``, this directory is traversed to discover the files. -``file_root`` is required in this mode of operation.)", +If not using `file_list` or `files`. this directory is traversed to discover the files. +`file_root` is required in this mode of operation.)", nullptr) .AddOptionalArg("file_list", R"(Path to a text file that contains one whitespace-separated ``filename label`` -pair per line. The filenames are relative to the location of that file or to ``file_root``, +pair per line. The filenames are relative to the location of that file or to `file_root`, if specified. -This argument is mutually exclusive with ``files``.)", nullptr) +This argument is mutually exclusive with `files`.)", nullptr) .AddOptionalArg("shuffle_after_epoch", R"(If set to True, the reader shuffles the entire dataset after each epoch. -``stick_to_shard`` and ``random_shuffle`` cannot be used when this argument is set to True.)", +`stick_to_shard` and `random_shuffle` cannot be used when this argument is set to True.)", false) .AddOptionalArg>("files", R"(A list of file paths to read the data from. -If ``file_root`` is provided, the paths are treated as being relative to it. -When using ``files``, the labels are taken from ``labels`` argument or, if it was not supplied, -contain indices at which given file appeared in the ``files`` list. +If `file_root` is provided, the paths are treated as being relative to it. +When using `files`, the labels are taken from `labels` argument or, if it was not supplied, +contain indices at which given file appeared in the `files` list. -This argument is mutually exclusive with ``file_list``.)", nullptr) +This argument is mutually exclusive with `file_list`.)", nullptr) .AddOptionalArg>("labels", R"(Labels accompanying contents of files listed in -``files`` argument. +`files` argument. If not used, sequential 0-based indices are used as labels)", nullptr) .AddOptionalArg("file_filters", R"(A list of glob strings to filter the -list of files in the sub-directories of the ``file_root``. +list of files in the sub-directories of the `file_root`. -This argument is ignored when file paths are taken from ``file_list`` or ``files``.)", +This argument is ignored when file paths are taken from `file_list` or `files`.)", kKnownExtensionsGlob) .AddOptionalArg>("dir_filters", R"(A list of glob strings to filter the -list of sub-directories under ``file_root``. +list of sub-directories under `file_root`. -This argument is ignored when file paths are taken from ``file_list`` or ``files``.)", nullptr) +This argument is ignored when file paths are taken from `file_list` or `files`.)", nullptr) .AddOptionalArg("case_sensitive_filter", R"(If set to True, the filter will be matched case-sensitively, otherwise case-insensitively.)", false) .AddParent("LoaderBase"); diff --git a/dali/operators/reader/fits_reader_op.cc b/dali/operators/reader/fits_reader_op.cc index addeaf1cfb0..efaa98d7664 100644 --- a/dali/operators/reader/fits_reader_op.cc +++ b/dali/operators/reader/fits_reader_op.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2020-2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// Copyright (c) 2020-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -39,10 +39,10 @@ DALI_SCHEMA(experimental__readers__Fits) This operator can be used in the following modes: -1. Read all files from a directory indicated by ``file_root`` that match given ``file_filter``. -2. Read file names from a text file indicated in ``file_list`` argument. -3. Read files listed in ``files`` argument. -4. Number of outputs per sample corresponds to the length of ``hdu_indices`` argument. By default, +1. Read all files from a directory indicated by `file_root` that match given `file_filter`. +2. Read file names from a text file indicated in `file_list` argument. +3. Read files listed in `files` argument. +4. Number of outputs per sample corresponds to the length of `hdu_indices` argument. By default, first HDU with data is read from each file, so the number of outputs defaults to 1. )") .NumInput(0) @@ -50,32 +50,32 @@ first HDU with data is read from each file, so the number of outputs defaults to .AddOptionalArg("file_root", R"(Path to a directory that contains the data files. -If not using ``file_list`` or ``files``, this directory is traversed to discover the files. -``file_root`` is required in this mode of operation.)", +If not using `file_list` or `files`. this directory is traversed to discover the files. +`file_root` is required in this mode of operation.)", nullptr) .AddOptionalArg( "file_filter", R"(If a value is specified, the string is interpreted as glob string to filter the -list of files in the sub-directories of the ``file_root``. +list of files in the sub-directories of the `file_root`. -This argument is ignored when file paths are taken from ``file_list`` or ``files``.)", +This argument is ignored when file paths are taken from `file_list` or `files`.)", "*.fits") .AddOptionalArg("file_list", R"(Path to a text file that contains filenames (one per line). -The filenames are relative to the location of the text file or to ``file_root``, if specified. +The filenames are relative to the location of the text file or to `file_root`, if specified. -This argument is mutually exclusive with ``files``.)", +This argument is mutually exclusive with `files`.)", nullptr) .AddOptionalArg("shuffle_after_epoch", R"(If set to True, the reader shuffles the entire dataset after each epoch. -``stick_to_shard`` and ``random_shuffle`` cannot be used when this argument is set to True.)", +`stick_to_shard` and `random_shuffle` cannot be used when this argument is set to True.)", false) .AddOptionalArg>("files", R"(A list of file paths to read the data from. -If ``file_root`` is provided, the paths are treated as being relative to it. +If `file_root` is provided, the paths are treated as being relative to it. -This argument is mutually exclusive with ``file_list``.)", +This argument is mutually exclusive with `file_list`.)", nullptr) .AddOptionalArg("hdu_indices", R"(HDU indices to read. If not provided, the first HDU after the primary diff --git a/dali/operators/reader/loader/file_label_loader.h b/dali/operators/reader/loader/file_label_loader.h index 29f6e8106c0..337e202adf7 100755 --- a/dali/operators/reader/loader/file_label_loader.h +++ b/dali/operators/reader/loader/file_label_loader.h @@ -83,7 +83,7 @@ class DLL_PUBLIC FileLabelLoaderBase : public Loader 0, "``file_filters`` list cannot be empty."); diff --git a/dali/operators/reader/loader/loader.cc b/dali/operators/reader/loader/loader.cc index e050c7eb136..7bbacf1504a 100644 --- a/dali/operators/reader/loader/loader.cc +++ b/dali/operators/reader/loader/loader.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved. +// Copyright (c) 2017-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -21,12 +21,12 @@ DALI_SCHEMA(LoaderBase) .AddOptionalArg("random_shuffle", R"code(Determines whether to randomly shuffle data. -A prefetch buffer with a size equal to ``initial_fill`` is used to read data sequentially, +A prefetch buffer with a size equal to `initial_fill` is used to read data sequentially, and then samples are selected randomly to form a batch.)code", false) .AddOptionalArg("initial_fill", R"code(Size of the buffer that is used for shuffling. -If ``random_shuffle`` is False, this parameter is ignored.)code", 1024) +If `random_shuffle` is False, this parameter is ignored.)code", 1024) .AddOptionalArg("num_shards", R"code(Partitions the data into the specified number of parts (shards). diff --git a/dali/operators/reader/numpy_reader_op.cc b/dali/operators/reader/numpy_reader_op.cc index 9c5be56913b..68dc650dcb9 100644 --- a/dali/operators/reader/numpy_reader_op.cc +++ b/dali/operators/reader/numpy_reader_op.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2020-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// Copyright (c) 2020-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -100,9 +100,9 @@ DALI_SCHEMA(readers__Numpy) This operator can be used in the following modes: -1. Read all files from a directory indicated by ``file_root`` that match given ``file_filter``. -2. Read file names from a text file indicated in ``file_list`` argument. -3. Read files listed in ``files`` argument. +1. Read all files from a directory indicated by `file_root` that match given `file_filter`. +2. Read file names from a text file indicated in `file_list` argument. +3. Read files listed in `files` argument. .. note:: The ``gpu`` backend requires cuFile/GDS support (418.x driver family or newer). which is @@ -119,29 +119,29 @@ This operator can be used in the following modes: .AddOptionalArg("file_root", R"(Path to a directory that contains the data files. -If not using ``file_list`` or ``files``, this directory is traversed to discover the files. -``file_root`` is required in this mode of operation.)", +If not using `file_list` or `files`. this directory is traversed to discover the files. +`file_root` is required in this mode of operation.)", nullptr) .AddOptionalArg("file_filter", R"(If a value is specified, the string is interpreted as glob string to filter the -list of files in the sub-directories of the ``file_root``. +list of files in the sub-directories of the `file_root`. -This argument is ignored when file paths are taken from ``file_list`` or ``files``.)", "*.npy") +This argument is ignored when file paths are taken from `file_list` or `files`.)", "*.npy") .AddOptionalArg("file_list", R"(Path to a text file that contains filenames (one per line) -where the filenames are relative to the location of that file or to ``file_root``, if specified. +where the filenames are relative to the location of that file or to `file_root`, if specified. -This argument is mutually exclusive with ``files``.)", nullptr) +This argument is mutually exclusive with `files`.)", nullptr) .AddOptionalArg("shuffle_after_epoch", R"(If set to True, the reader shuffles the entire dataset after each epoch. -``stick_to_shard`` and ``random_shuffle`` cannot be used when this argument is set to True.)", +`stick_to_shard` and `random_shuffle` cannot be used when this argument is set to True.)", false) .AddOptionalArg>("files", R"(A list of file paths to read the data from. -If ``file_root`` is provided, the paths are treated as being relative to it. +If `file_root` is provided, the paths are treated as being relative to it. -This argument is mutually exclusive with ``file_list``.)", nullptr) +This argument is mutually exclusive with `file_list`.)", nullptr) .AddOptionalArg("register_buffers", R"code(Applies **only** to the ``gpu`` backend type. @@ -204,11 +204,11 @@ Here is a list of the supported values: - ``"error"`` (default): Attempting to read outside of the bounds of the image will produce an error. - ``"pad"``: The array will be padded as needed with zeros or any other value that is specified - with the ``fill_value`` argument. + with the `fill_value` argument. - ``"trim_to_shape"``: The ROI will be cut to the bounds of the array.)code", "error") .AddOptionalArg("fill_value", - R"code(Determines the padding value when ``out_of_bounds_policy`` is set to “pad”.)code", + R"code(Determines the padding value when `out_of_bounds_policy` is set to “pad”.)code", 0.f) .AddOptionalArg("use_o_direct", R"code(If set to True, the data will be read directly from the storage bypassing system diff --git a/dali/operators/reader/sequence_reader_op.cc b/dali/operators/reader/sequence_reader_op.cc index d0f3714aa75..18f9cb101fc 100644 --- a/dali/operators/reader/sequence_reader_op.cc +++ b/dali/operators/reader/sequence_reader_op.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. +// Copyright (c) 2018-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -28,7 +28,7 @@ DALI_SCHEMA(readers__Sequence) .DocStr( R"code(Reads [Frame] sequences from a directory representing a collection of streams. -This operator expects ``file_root`` to contain a set of directories, where each directory represents +This operator expects `file_root` to contain a set of directories, where each directory represents an extracted video stream. This stream is represented by one file for each frame, sorted lexicographically. Sequences do not cross the stream boundary and only complete sequences are considered, so there is no padding. diff --git a/dali/operators/reader/video_reader_decoder_cpu_op.cc b/dali/operators/reader/video_reader_decoder_cpu_op.cc index 72826a16619..b76d80112a0 100644 --- a/dali/operators/reader/video_reader_decoder_cpu_op.cc +++ b/dali/operators/reader/video_reader_decoder_cpu_op.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2021-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// Copyright (c) 2021-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -62,7 +62,7 @@ DALI_SCHEMA(experimental__readers__Video) .DocStr(R"code(Loads and decodes video files using FFmpeg. The video streams can be in most of the container file formats. FFmpeg is used to parse video -containers and returns a batch of sequences of ``sequence_length`` frames with shape +containers and returns a batch of sequences of `sequence_length` frames with shape ``(N, F, H, W, C)``, where ``N`` is the batch size, and ``F`` is the number of frames). .. note:: @@ -75,7 +75,7 @@ even in the variable frame rate scenario.)code") R"code(Absolute paths to the video files to load.)code", std::vector{}) .AddOptionalArg>("labels", R"(Labels associated with the files listed in -``filenames`` argument. If not provided, no labels will be yielded.)", nullptr) +`filenames` argument. If not provided, no labels will be yielded.)", nullptr) .AddArg("sequence_length", R"code(Frames to load per sequence.)code", DALI_INT32) @@ -86,7 +86,7 @@ as an additional output.)code", .AddOptionalArg("step", R"code(Frame interval between each sequence. -When the value is less than 0, ``step`` is set to ``sequence_length``.)code", +When the value is less than 0, `step` is set to `sequence_length`.)code", -1) .AddOptionalArg("stride", R"code(Distance between consecutive frames in the sequence.)code", 1u, false) diff --git a/dali/operators/reader/video_reader_op.cc b/dali/operators/reader/video_reader_op.cc index f06d0e1e74a..e25178a6481 100644 --- a/dali/operators/reader/video_reader_op.cc +++ b/dali/operators/reader/video_reader_op.cc @@ -75,7 +75,7 @@ DALI_SCHEMA(readers__Video) the hardware-accelerated video decoding feature in the NVIDIA(R) GPU. The video streams can be in most of the container file formats. FFmpeg is used to parse video -containers and returns a batch of sequences of ``sequence_length`` frames with shape +containers and returns a batch of sequences of `sequence_length` frames with shape ``(N, F, H, W, C)``, where ``N`` is the batch size, and ``F`` is the number of frames). This class only supports constant frame rate videos. @@ -87,32 +87,32 @@ This class only supports constant frame rate videos. .AddOptionalArg("filenames", R"code(File names of the video files to load. -This option is mutually exclusive with ``file_list`` and ``file_root``.)code", +This option is mutually exclusive with `file_list` and `file_root`.)code", std::vector{}) .AddOptionalArg>("labels", R"(Labels associated with the files listed in -``filenames`` argument. +`filenames` argument. If an empty list is provided, sequential 0-based indices are used as labels. If not provided, no labels will be yielded.)", nullptr) .AddOptionalArg("file_root", R"code(Path to a directory that contains the data files. -This option is mutually exclusive with ``filenames`` and ``file_list``.)code", +This option is mutually exclusive with `filenames` and `file_list`.)code", std::string()) .AddOptionalArg("file_list", R"code(Path to the file with a list of ``file label [start_frame [end_frame]]`` values. Positive value means the exact frame, negative counts as a Nth frame from the end (it follows python array indexing schema), equal values for the start and end frame would yield an empty -sequence and a warning. This option is mutually exclusive with ``filenames`` -and ``file_root``.)code", +sequence and a warning. This option is mutually exclusive with `filenames` +and `file_root`.)code", std::string()) .AddOptionalArg("enable_frame_num", - R"code(If the ``file_list`` or ``filenames`` argument is passed, returns the frame number + R"code(If the `file_list` or `filenames` argument is passed, returns the frame number output.)code", false) .AddOptionalArg("enable_timestamps", - R"code(If the ``file_list`` or ``filenames`` argument is passed, returns the timestamps + R"code(If the `file_list` or `filenames` argument is passed, returns the timestamps output. )code", false) .AddArg("sequence_length", @@ -121,7 +121,7 @@ output. )code", .AddOptionalArg("step", R"code(Frame interval between each sequence. -When the value is less than 0, ``step`` is set to ``sequence_length``.)code", +When the value is less than 0, `step` is set to `sequence_length`.)code", -1) .AddOptionalArg("channels", R"code(Number of channels.)code", @@ -169,7 +169,7 @@ the end frame number will be rounded down. Frame numbers start from 0.)code", false) .AddOptionalArg("file_list_include_preceding_frame", - R"code(Changes the behavior how ``file_list`` start and end frame timestamps are translated + R"code(Changes the behavior how `file_list` start and end frame timestamps are translated to a frame number. If the start/end timestamps are provided in file_list as timestamps, the start frame is @@ -181,7 +181,7 @@ timestamps are correlated with displayed video frames. .. note:: - When ``file_list_frame_num`` is set to True, this option does not take any effect. + When `file_list_frame_num` is set to True, this option does not take any effect. .. warning:: diff --git a/dali/operators/reader/video_reader_op.h b/dali/operators/reader/video_reader_op.h index 9da1f41c6d4..6d10797dfea 100644 --- a/dali/operators/reader/video_reader_op.h +++ b/dali/operators/reader/video_reader_op.h @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// Copyright (c) 2017-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -84,7 +84,7 @@ class VideoReader : public DataReader()) .AddOptionalArg( diff --git a/dali/operators/segmentation/random_mask_pixel.cc b/dali/operators/segmentation/random_mask_pixel.cc index 0b722796468..159e91a64a6 100644 --- a/dali/operators/segmentation/random_mask_pixel.cc +++ b/dali/operators/segmentation/random_mask_pixel.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2020-2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// Copyright (c) 2020-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -29,21 +29,21 @@ namespace dali { DALI_SCHEMA(segmentation__RandomMaskPixel) .DocStr(R"(Selects random pixel coordinates in a mask, sampled from a uniform distribution. -Based on run-time argument ``foreground``, it returns either only foreground pixels or any pixels. +Based on run-time argument `foreground`, it returns either only foreground pixels or any pixels. -Pixels are classified as foreground either when their value exceeds a given ``threshold`` or when -it's equal to a specific ``value``. +Pixels are classified as foreground either when their value exceeds a given `threshold` or when +it's equal to a specific `value`. )") .AddOptionalArg("value", R"code(All pixels equal to this value are interpreted as foreground. -This argument is mutually exclusive with ``threshold`` argument and is meant to be used only +This argument is mutually exclusive with `threshold` argument and is meant to be used only with integer inputs. )code", nullptr, true) .AddOptionalArg("threshold", R"code(All pixels with a value above this threshold are interpreted as foreground. -This argument is mutually exclusive with ``value`` argument. +This argument is mutually exclusive with `value` argument. )code", 0.0f, true) .AddOptionalArg("foreground", R"code(If different than 0, the pixel position is sampled uniformly from all foreground pixels. diff --git a/dali/operators/segmentation/random_object_bbox.cc b/dali/operators/segmentation/random_object_bbox.cc index 33a28ec9eb1..07f675185aa 100644 --- a/dali/operators/segmentation/random_object_bbox.cc +++ b/dali/operators/segmentation/random_object_bbox.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2021-2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// Copyright (c) 2021-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -38,11 +38,11 @@ using kernels::label_bbox::GetLabelBoundingBoxes; DALI_SCHEMA(segmentation__RandomObjectBBox) .DocStr(R"(Randomly selects an object from a mask and returns its bounding box. -This operator takes a labeled segmentation map as its input. With probability ``foreground_prob`` -it randomly selects a label (uniformly or according to the distribution given as ``class_weights``), +This operator takes a labeled segmentation map as its input. With probability `foreground_prob` +it randomly selects a label (uniformly or according to the distribution given as `class_weights`), extracts connected blobs of pixels with the selected label and randomly selects one of the blobs. -The blobs may be further filtered according to ``k_largest`` and ``threshold``. -The output is a bounding box of the selected blob in one of the formats described in ``format``. +The blobs may be further filtered according to `k_largest` and `threshold`. +The output is a bounding box of the selected blob in one of the formats described in `format`. With probability 1-foreground_prob, the entire area of the input is returned.)") .NumInput(1) @@ -55,7 +55,7 @@ With probability 1-foreground_prob, the entire area of the input is returned.)") regardless of the class they belong to. Otherwise, a class is picked first and then an object is randomly selected from this class. -This argument is incompatible with ``classes``, ``class_weights`` or ``output_class``. +This argument is incompatible with `classes`, `class_weights` or `output_class`. .. note:: This flag only affects the probability with which blobs are selected. It does not cause @@ -65,29 +65,29 @@ label of the class to which the selected box belongs, or background label if the is not an object bounding box. The output may not be an object bounding box when any of the following conditions occur: - - the sample was randomly (according to ``foreground_prob``) chosen not be be a foreground one + - the sample was randomly (according to `foreground_prob`) chosen not be be a foreground one - the sample contained no foreground objects - no bounding box met the required size threshold.)", false) .AddOptionalArg("foreground_prob", "Probability of selecting a foreground bounding box.", 1.0f, true) .AddOptionalArg>("classes", R"(List of labels considered as foreground. -If left unspecified, all labels not equal to ``background`` are considered foreground.)", +If left unspecified, all labels not equal to `background` are considered foreground.)", nullptr, true) .AddOptionalArg("background", R"(Background label. -If left unspecified, it's either 0 or any value not in ``classes``.)", 0, true) +If left unspecified, it's either 0 or any value not in `classes`.)", 0, true) .AddOptionalArg>("class_weights", R"(Relative probabilities of foreground classes. -Each value corresponds to a class label in ``classes``. If ``classes`` are not specified, +Each value corresponds to a class label in `classes`. If `classes` are not specified, consecutive 1-based labels are assigned. The sum of the weights doesn't have to be equal to 1 - if it isn't the weights will be normalized .)", nullptr, true) .AddOptionalArg("k_largest", R"(If specified, the boxes are sorted by decreasing volume -and only ``k_largest`` are considered. +and only `k_largest` are considered. -If ``ignore_class`` is True, ``k_largest`` referes to all boxes; otherwise it refers to the +If `ignore_class` is True, `k_largest` referes to all boxes; otherwise it refers to the selected class.)", nullptr) .AddOptionalArg>("threshold", R"(Per-axis minimum size of the bounding boxes diff --git a/dali/operators/segmentation/select_masks.cc b/dali/operators/segmentation/select_masks.cc index f7ff9f01377..930fd3dba96 100644 --- a/dali/operators/segmentation/select_masks.cc +++ b/dali/operators/segmentation/select_masks.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2020-2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// Copyright (c) 2020-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -45,7 +45,7 @@ Let us assume the following input mask, where symbolic coordinates are used for Example 1: Selecting a single mask with id ``1``, maintaining the original id:: - mask_ids = [1], ``reindex_masks`` = False + mask_ids = [1], `reindex_masks` = False out_polygons = [[1, 0, 4]] out_vertices = [[x3, y3], [x4, y4], [x5, y5], [x6, y6]] diff --git a/dali/operators/sequence/element_extract.cc b/dali/operators/sequence/element_extract.cc index b7ccce094dc..6817721ba28 100644 --- a/dali/operators/sequence/element_extract.cc +++ b/dali/operators/sequence/element_extract.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2019-2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// Copyright (c) 2019-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -21,7 +21,7 @@ DALI_SCHEMA(ElementExtract) .DocStr(R"code(Extracts one or more elements from input sequence. The outputs are slices in the first (outermost) dimension of the input. -There are as many outputs as the elements provided in the ``element_map``. +There are as many outputs as the elements provided in the `element_map`. For example, for ``element_map = [2, 0, 3]`` there will be three outputs, containing 2nd, 0th and 3rd element of the input sequences respectively. diff --git a/dali/operators/sequence/per_frame.cc b/dali/operators/sequence/per_frame.cc index fce36656ccf..bb0e2ee0ba4 100644 --- a/dali/operators/sequence/per_frame.cc +++ b/dali/operators/sequence/per_frame.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// Copyright (c) 2022-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -44,7 +44,7 @@ to find out if it supports per-frame input. If the input passed to ``per-frame`` operator has no layout, a new layout is set, that starts with ``F`` and is padded with ``*`` to match -dimensionality of the input. Otherwise, depending on the ``replace`` flag, +dimensionality of the input. Otherwise, depending on the `replace` flag, the operator either checks if the first character of the layout is equal to ``F`` or replaces the character with ``F``. )code") diff --git a/dali/operators/sequence/sequence_rearrange.cc b/dali/operators/sequence/sequence_rearrange.cc index 7ea28044160..dd696df949f 100644 --- a/dali/operators/sequence/sequence_rearrange.cc +++ b/dali/operators/sequence/sequence_rearrange.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2019-2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// Copyright (c) 2019-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -33,7 +33,7 @@ Output sequence at position ``i`` will contain element ``new_order[i]`` from inp out[i, ...] = in[new_order[i], ...] Elements can be repeated or dropped, but empty output sequences are not allowed. Only indices in -``[0, input_outermost_extent)`` are allowed to be used in ``new_order``. Can be specified +``[0, input_outermost_extent)`` are allowed to be used in `new_order`. Can be specified per sample as 1D tensors.)code", DALI_INT_VEC, true); diff --git a/dali/operators/signal/fft/power_spectrum.cc b/dali/operators/signal/fft/power_spectrum.cc index fd5c7281b83..bb7e2e0e114 100644 --- a/dali/operators/signal/fft/power_spectrum.cc +++ b/dali/operators/signal/fft/power_spectrum.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2019-2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// Copyright (c) 2019-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -31,7 +31,7 @@ DALI_SCHEMA(PowerSpectrum) .AddOptionalArg("nfft", R"code(Size of the FFT. -By default, the ``nfft`` is selected to match the length of the data in the transformation axis. +By default, the `nfft` is selected to match the length of the data in the transformation axis. The number of bins that are created in the output is calculated with the following formula:: diff --git a/dali/operators/signal/fft/spectrogram.cc b/dali/operators/signal/fft/spectrogram.cc index dd486240072..e098ff29e52 100644 --- a/dali/operators/signal/fft/spectrogram.cc +++ b/dali/operators/signal/fft/spectrogram.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2019-2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// Copyright (c) 2019-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -52,7 +52,7 @@ The number of bins that are created in the output is ``nfft // 2 + 1``. R"(Samples of the window function that will be multiplied to each extracted window when calculating the STFT. -If a value is provided, it should be a list of floating point numbers of size ``window_length``. +If a value is provided, it should be a list of floating point numbers of size `window_length`. If a value is not provided, a Hann window will be used.)", std::vector{}) .AddOptionalArg("power", @@ -66,7 +66,7 @@ Supported values: 2) .AddOptionalArg("center_windows", R"(Indicates whether extracted windows should be padded so that the window function is -centered at multiples of ``window_step``. +centered at multiples of `window_step`. If set to False, the signal will not be padded, that is, only windows within the input range will be extracted.)", @@ -78,7 +78,7 @@ If set to True, the signal is mirrored with respect to the boundary, otherwise t is padded with zeros. .. note:: - When ``center_windows`` is set to False, this option is ignored. + When `center_windows` is set to False, this option is ignored. )", true) .AddOptionalArg("layout", R"(Output layout: "ft" (frequency-major) or "tf" (time-major).)", diff --git a/dali/operators/ssd/box_encoder.cc b/dali/operators/ssd/box_encoder.cc index 22f0edcdfce..983091d73d7 100644 --- a/dali/operators/ssd/box_encoder.cc +++ b/dali/operators/ssd/box_encoder.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// Copyright (c) 2017-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -219,7 +219,7 @@ The value needs to be between 0 and 1.)code", .AddOptionalArg( "offset", R"code(Returns normalized offsets ``((encoded_bboxes*scale - anchors*scale) - mean) / stds`` -in EncodedBBoxes that use ``std`` and the ``mean`` and ``scale`` arguments.)code", +in EncodedBBoxes that use ``std`` and the ``mean`` and `scale` arguments.)code", false) .AddOptionalArg("scale", R"code(Rescales the box and anchor values before the offset is calculated diff --git a/dali/operators/util/get_property.cc b/dali/operators/util/get_property.cc index f6abb90cf78..e2bb9b7d88e 100644 --- a/dali/operators/util/get_property.cc +++ b/dali/operators/util/get_property.cc @@ -21,7 +21,7 @@ DALI_SCHEMA(GetProperty) .DocStr( R"code(Returns a property of the tensor passed as an input. -The type of the output will depend on the ``key`` of the requested property.)code") +The type of the output will depend on the `key` of the requested property.)code") .NumInput(1) .InputDevice(0, InputDevice::Metadata) .NumOutput(1) diff --git a/dali/pipeline/operator/builtin/external_source.cc b/dali/pipeline/operator/builtin/external_source.cc index 2785176ea85..77dd692b516 100644 --- a/dali/pipeline/operator/builtin/external_source.cc +++ b/dali/pipeline/operator/builtin/external_source.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// Copyright (c) 2017-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -64,7 +64,7 @@ This argument will be required starting from DALI 2.0.)code") The dimensionality of the data provided to the operator will be verified against this value. Number of dimensions can be also inferred from the ``layout`` argument if provided. -If the ``layout`` argument is provided, the ``ndim`` must match the number +If the ``layout`` argument is provided, the `ndim` must match the number of dimensions in the layout. Specifying the input dimensionality will be required starting from DALI 2.0)code", nullptr) diff --git a/dali/pipeline/operator/builtin/input_operator.cc b/dali/pipeline/operator/builtin/input_operator.cc index ba2bcc1979e..922f4c69842 100644 --- a/dali/pipeline/operator/builtin/input_operator.cc +++ b/dali/pipeline/operator/builtin/input_operator.cc @@ -39,7 +39,7 @@ have been consumed. Effectively, it happens after ``prefetch_queue_depth`` or ``cpu_queue_depth * gpu_queue_depth`` (when they are not equal) iterations following the ``feed_input`` call. -The memory location must match the specified ``device`` parameter of the operator. +The memory location must match the specified `device` parameter of the operator. For the CPU, the provided memory can be one contiguous buffer or a list of contiguous Tensors. For the GPU, to avoid extra copy, the provided buffer must be contiguous. If you provide a list of separate Tensors, there will be an additional copy made internally, consuming both memory diff --git a/dali/pipeline/operator/op_schema.cc b/dali/pipeline/operator/op_schema.cc index 2b3fdff82cd..e38f0a0a490 100644 --- a/dali/pipeline/operator/op_schema.cc +++ b/dali/pipeline/operator/op_schema.cc @@ -938,13 +938,13 @@ std::string OpSchema::DefaultDeprecatedArgMsg(const std::string &arg_name, const std::string &renamed_to, bool removed) const { std::stringstream ss; if (removed) { - ss << "The argument ``" << arg_name - << "`` is no longer used and will be removed in a future release."; + ss << "The argument `" << arg_name + << "` is no longer used and will be removed in a future release."; } else if (!renamed_to.empty()) { - ss << "The argument ``" << arg_name << "`` is a deprecated alias for ``" << renamed_to - << "``. Use ``" << renamed_to << "`` instead."; + ss << "The argument `" << arg_name << "` is a deprecated alias for `" << renamed_to + << "`. Use `" << renamed_to << "` instead."; } else { - ss << "The argument ``" << arg_name << "`` is now deprecated and its usage is discouraged."; + ss << "The argument `" << arg_name << "` is now deprecated and its usage is discouraged."; } return ss.str(); } diff --git a/dali/python/nvidia/dali/auto_aug/rand_augment.py b/dali/python/nvidia/dali/auto_aug/rand_augment.py index 690b611c3fa..0b636c6b54c 100644 --- a/dali/python/nvidia/dali/auto_aug/rand_augment.py +++ b/dali/python/nvidia/dali/auto_aug/rand_augment.py @@ -1,4 +1,4 @@ -# Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# Copyright (c) 2023-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -150,9 +150,9 @@ def apply_rand_augment( **kwargs, ) -> _DataNode: """ - Applies the list of ``augmentations`` in RandAugment (https://arxiv.org/abs/1909.13719) fashion. - Each sample is transformed with ``n`` operations in a sequence randomly selected from the - ``augmentations`` list. Each operation uses ``m`` as the magnitude bin. + Applies the list of `augmentations` in RandAugment (https://arxiv.org/abs/1909.13719) fashion. + Each sample is transformed with `n` operations in a sequence randomly selected from the + `augmentations` list. Each operation uses `m` as the magnitude bin. Args ---- diff --git a/dali/python/nvidia/dali/external_source.py b/dali/python/nvidia/dali/external_source.py index 9d13b2f9ce4..8f27fa196f3 100644 --- a/dali/python/nvidia/dali/external_source.py +++ b/dali/python/nvidia/dali/external_source.py @@ -304,7 +304,7 @@ class ExternalSource: """ExternalSource is a special operator that can provide data to a DALI pipeline from Python by several methods. - The simplest and preferred way is to specify a ``source``, which can be a callable or iterable. + The simplest and preferred way is to specify a `source`, which can be a callable or iterable. .. note:: :meth:`nvidia.dali.fn.external_source` operator is partially compatible with TensorFlow @@ -324,9 +324,9 @@ class ExternalSource: The source is polled for data (via a call ``source()`` or ``next(source)``) when the pipeline needs input for the next iteration. Depending on the value of - ``num_outputs``, the source can supply one or more data items. The data item can be - a whole batch (default) or a single batch entry (when ``batch==False``). If ``num_outputs`` - is not set, the ``source`` is expected to return one item (a batch or a sample). + `num_outputs`, the source can supply one or more data items. The data item can be + a whole batch (default) or a single batch entry (when ``batch==False``). If `num_outputs` + is not set, the `source` is expected to return one item (a batch or a sample). If this value is specified (even if its value is 1), the data is expected to a be tuple, or list, where each element corresponds to respective return value of the external_source. @@ -356,13 +356,13 @@ class ExternalSource: in current epoch and in the batch, as well as current iteration number. If the source is a generator function, the function is invoked and treated as an iterable. - However, unlike a generator, the function can be used with ``cycle``. In this case, + However, unlike a generator, the function can be used with `cycle`. In this case, the function will be called again when the generator reaches the end of iteration. For GPU inputs, it is a user's responsibility to modify the provided GPU memory content only in the provided stream. DALI schedules a copy on this stream, and all work is properly queued. If no stream is provided, DALI will use a default, with a best-effort approach at - correctness. See the ``cuda_stream`` argument documentation for more information. + correctness. See the `cuda_stream` argument documentation for more information. .. note:: After restoring from checkpoint, queries to sources that are single-argument callables @@ -388,7 +388,7 @@ class ExternalSource: * ``"raise"`` - when the end of data is reached, ``StopIteration`` is raised, but the iteration is restarted on subsequent call. - This flag requires that the ``source`` is a collection, for example, an iterable + This flag requires that the `source` is a collection, for example, an iterable object where ``iter(source)`` returns a fresh iterator on each call, or a generator function. In the latter case, the generator function is called again when more data than was yielded by the function is requested. @@ -399,19 +399,19 @@ class ExternalSource: The name of the data node. Used when feeding the data with a call to ``feed_input`` and can be omitted if - the data is provided by ``source``. + the data is provided by `source`. layout : :ref:`layout str` or list/tuple thereof, optional If provided, sets the layout of the data. When ``num_outputs > 1``, the layout can be a list that contains a distinct layout - for each output. If the list has fewer than ``num_outputs`` elements, only + for each output. If the list has fewer than `num_outputs` elements, only the first outputs have the layout set, the rest of the outputs don't have a layout set. dtype : `nvidia.dali.types.DALIDataType` or list/tuple thereof, optional Input data type. - When ``num_outputs > 1``, the ``dtype`` can be a list that contains a distinct + When ``num_outputs > 1``, the `dtype` can be a list that contains a distinct value for each output. The operator will validate that the fetched data is of the provided type. @@ -423,13 +423,13 @@ class ExternalSource: ndim : int or list/tuple thereof, optional Number of dimensions in the input data. - When ``num_outputs > 1``, the ``ndim`` can be a list that contains a distinct value for each + When ``num_outputs > 1``, the `ndim` can be a list that contains a distinct value for each output. The dimensionality of the data provided to the operator will be verified against this value. - Number of dimensions can be also inferred from the ``layout`` argument if provided. + Number of dimensions can be also inferred from the `layout` argument if provided. - If the ``layout`` argument is provided, the ``ndim`` must match + If the `layout` argument is provided, the `ndim` must match the number of dimensions in the layout. Specifying the input dimensionality will be required starting from DALI 2.0 @@ -473,11 +473,11 @@ class ExternalSource: consumed by the pipeline. The buffer can be modified or freed again after the output of the relevant iterations - has been consumed. Effectively, it happens after Pipeline's ``prefetch_queue_depth`` or + has been consumed. Effectively, it happens after Pipeline's `prefetch_queue_depth` or ``cpu_queue_depth * gpu_queue_depth`` (when they are not equal) iterations following the ``feed_input`` call. - The memory location must match the specified ``device`` parameter of the operator. + The memory location must match the specified `device` parameter of the operator. For the CPU, the provided memory can be one contiguous buffer or a list of contiguous Tensors. For the GPU, to avoid extra copy, the provided buffer must be contiguous. If you provide a list of separate Tensors, there will be an additional @@ -486,50 +486,50 @@ class ExternalSource: Automatically set to ``True`` when ``parallel=True`` batch : bool, optional - If set to True or None, the ``source`` is expected to produce an entire batch at once. - If set to False, the ``source`` is called per-sample. + If set to True or None, the `source` is expected to produce an entire batch at once. + If set to False, the `source` is called per-sample. - Setting ``parallel`` to True automatically sets ``batch`` to False if it was not provided. + Setting `parallel` to True automatically sets `batch` to False if it was not provided. batch_info : bool, optional, default = False - Controls if a callable ``source`` that accepts an argument and returns batches + Controls if a callable `source` that accepts an argument and returns batches should receive class:`~nvidia.dali.types.BatchInfo` instance or just an integer representing the iteration number. - If set to False (the default), only the integer is passed. If ``source`` is not callable, - does not accept arguments or ``batch`` is set to False, setting this flag has no effect. + If set to False (the default), only the integer is passed. If `source` is not callable, + does not accept arguments or `batch` is set to False, setting this flag has no effect. parallel : bool, optional, default = False If set to True, the corresponding pipeline will start a pool of Python workers to run the callback in parallel. You can specify the number of workers by passing ``py_num_workers`` into pipeline's constructor. - When ``parallel`` is set to True, samples returned by ``source`` must be + When `parallel` is set to True, samples returned by `source` must be NumPy/MXNet/PyTorch CPU arrays or TensorCPU instances. | - Acceptable sources depend on the value specified for ``batch`` parameter. + Acceptable sources depend on the value specified for `batch` parameter. - If ``batch`` is set to ``False``, the ``source`` must be: + If `batch` is set to ``False``, the `source` must be: * a callable (a function or an object with ``__call__`` method) that accepts exactly one argument (:class:`~nvidia.dali.types.SampleInfo` instance that represents the index of the requested sample). - If ``batch`` is set to ``True``, the ``source`` can be either: + If `batch` is set to ``True``, the `source` can be either: * a callable that accepts exactly one argument (either :class:`~nvidia.dali.types.BatchInfo` - instance or an integer - see ``batch_info`` for details) + instance or an integer - see `batch_info` for details) * an iterable, * a generator function. | .. warning:: - Irrespective of ``batch`` value, callables should be stateless - they should produce + Irrespective of `batch` value, callables should be stateless - they should produce requested sample or batch solely based on the :class:`~nvidia.dali.types.SampleInfo`/:class:`~nvidia.dali.types.BatchInfo` instance or index in batch, so that they can be run in parallel in a number of workers. - The ``source`` callback must raise a ``StopIteration`` when the end of + The `source` callback must raise a ``StopIteration`` when the end of the data is reached. Note, that due to prefetching, the callback may be invoked with a few iterations past the end of dataset - make sure it consistently raises a ``StopIteration`` in that case. @@ -537,7 +537,7 @@ class ExternalSource: | .. warning:: When the pipeline has conditional execution enabled, additional steps must - be taken to prevent the ``source`` from being rewritten by AutoGraph. + be taken to prevent the `source` from being rewritten by AutoGraph. There are two ways to achieve this: 1. Define the function at global scope (i.e. outside of ``pipeline_def`` scope). @@ -552,12 +552,12 @@ class ExternalSource: | .. note:: - Callable ``source`` can be run in parallel by multiple workers. + Callable `source` can be run in parallel by multiple workers. For ``batch=True`` multiple batches can be prepared in parallel, with ``batch=False`` it is possible to parallelize computation within the batch. When ``batch=True``, callables performance might especially benefit from increasing - ``prefetch_queue_depth`` so that a few next batches can be computed in parallel. + `prefetch_queue_depth` so that a few next batches can be computed in parallel. | .. note:: @@ -576,9 +576,9 @@ class ExternalSource: ``external_source`` will detect that no new data was fed between the previous pipeline run and the current one and will self-refeed with the most recent data. - Setting ``repeat_last`` to `True` only makes sense in "push" mode, i.e. when the data is + Setting `repeat_last` to `True` only makes sense in "push" mode, i.e. when the data is actively provided by the user via a call to ``feed_input``. Enabling this option - is incompatible with specifying the ``source``, which makes the ``external_source`` + is incompatible with specifying the `source`, which makes the ``external_source`` operate in "pull" mode. prefetch_queue_depth : int, optional, default = 1 @@ -1015,7 +1015,7 @@ def external_source( """ Creates a data node which is populated with data from a Python source. - The data can be provided by the ``source`` function or iterable, or it can be provided by + The data can be provided by the `source` function or iterable, or it can be provided by ``pipeline.feed_input(name, data, layout, cuda_stream)``. In the case of the GPU input, it is the user responsibility to modify the diff --git a/dali/python/nvidia/dali/math.py b/dali/python/nvidia/dali/math.py index 7c91630c2a9..7e52501bf2d 100644 --- a/dali/python/nvidia/dali/math.py +++ b/dali/python/nvidia/dali/math.py @@ -33,7 +33,7 @@ def _arithm_op(*args, **kwargs): def sqrt(input) -> _DataNode: - """Computes square root of values in ``input``. + """Computes square root of values in `input`. :rtype: TensorList of sqrt(input). If input is an integer, the result will be float, otherwise the type is preserved. @@ -42,7 +42,7 @@ def sqrt(input) -> _DataNode: def rsqrt(input) -> _DataNode: - """Computes reciprocal of the square root of values in ``input``. + """Computes reciprocal of the square root of values in `input`. :rtype: TensorList of rsqrt(input). If input is an integer, the result will be float, otherwise the type is preserved. @@ -51,7 +51,7 @@ def rsqrt(input) -> _DataNode: def cbrt(input) -> _DataNode: - """Computes cube root of values in ``input``. + """Computes cube root of values in `input`. :rtype: TensorList of cbrt(input). If input is an integer, the result will be float, otherwise the type is preserved. @@ -60,7 +60,7 @@ def cbrt(input) -> _DataNode: def exp(input) -> _DataNode: - """Computes exponential of values in ``input``. + """Computes exponential of values in `input`. :rtype: TensorList of exp(input). If input is an integer, the result will be float, otherwise the type is preserved. @@ -69,7 +69,7 @@ def exp(input) -> _DataNode: def log(input) -> _DataNode: - """Computes natural logarithm (base-e) of values in ``input``. + """Computes natural logarithm (base-e) of values in `input`. :rtype: TensorList of log(input). If input is an integer, the result will be float, otherwise the type is preserved. @@ -78,7 +78,7 @@ def log(input) -> _DataNode: def log2(input) -> _DataNode: - """Computes logarithm (base-2) of values in ``input``. + """Computes logarithm (base-2) of values in `input`. :rtype: TensorList of log2(input). If input is an integer, the result will be float, otherwise the type is preserved. @@ -87,7 +87,7 @@ def log2(input) -> _DataNode: def log10(input) -> _DataNode: - """Computes logarithm (base-10) of values in ``input``. + """Computes logarithm (base-10) of values in `input`. :rtype: TensorList of log10(input). If input is an integer, the result will be float, otherwise the type is preserved. @@ -96,7 +96,7 @@ def log10(input) -> _DataNode: def abs(input) -> _DataNode: - """Computes absolute value of values in ``input``. + """Computes absolute value of values in `input`. :rtype: TensorList of abs(input). The type is preserved. """ @@ -104,7 +104,7 @@ def abs(input) -> _DataNode: def fabs(input) -> _DataNode: - """Computes float absolute value of values in ``input``. + """Computes float absolute value of values in `input`. :rtype: TensorList of fabs(input). If input is an integer, the result will be float, otherwise the type is preserved. @@ -113,7 +113,7 @@ def fabs(input) -> _DataNode: def floor(input) -> _DataNode: - """Computes floor of values in ``input``. + """Computes floor of values in `input`. :rtype: TensorList of floor(input). If input is an integer, the result will be float, otherwise the type is preserved. @@ -122,7 +122,7 @@ def floor(input) -> _DataNode: def ceil(input) -> _DataNode: - """Computes ceil of values in ``input``. + """Computes ceil of values in `input`. :rtype: TensorList of ceil(input). If input is an integer, the result will be float, otherwise the type is preserved. @@ -131,7 +131,7 @@ def ceil(input) -> _DataNode: def sin(input) -> _DataNode: - """Computes sine of values in ``input``. + """Computes sine of values in `input`. :rtype: TensorList of sin(input). If input is an integer, the result will be float, otherwise the type is preserved. @@ -140,7 +140,7 @@ def sin(input) -> _DataNode: def cos(input) -> _DataNode: - """Computes cosine of values in ``input``. + """Computes cosine of values in `input`. :rtype: TensorList of cos(input). If input is an integer, the result will be float, otherwise the type is preserved. @@ -149,7 +149,7 @@ def cos(input) -> _DataNode: def tan(input) -> _DataNode: - """Computes tangent of values in ``input``. + """Computes tangent of values in `input`. :rtype: TensorList of tan(input). If input is an integer, the result will be float, otherwise the type is preserved. @@ -158,7 +158,7 @@ def tan(input) -> _DataNode: def asin(input) -> _DataNode: - """Computes arcus sine of values in ``input``. + """Computes arcus sine of values in `input`. :rtype: TensorList of asin(input). If input is an integer, the result will be float, otherwise the type is preserved. @@ -167,7 +167,7 @@ def asin(input) -> _DataNode: def acos(input) -> _DataNode: - """Computes arcus cosine of values in ``input``. + """Computes arcus cosine of values in `input`. :rtype: TensorList of acos(input). If input is an integer, the result will be float, otherwise the type is preserved. @@ -176,7 +176,7 @@ def acos(input) -> _DataNode: def atan(input) -> _DataNode: - """Computes arcus tangent of values in ``input``. + """Computes arcus tangent of values in `input`. :rtype: TensorList of atan(input). If input is an integer, the result will be float, otherwise the type is preserved. @@ -185,7 +185,7 @@ def atan(input) -> _DataNode: def sinh(input) -> _DataNode: - """Computes hyperbolic sine of values in ``input``. + """Computes hyperbolic sine of values in `input`. :rtype: TensorList of sinh(input). If input is an integer, the result will be float, otherwise the type is preserved. @@ -194,7 +194,7 @@ def sinh(input) -> _DataNode: def cosh(input) -> _DataNode: - """Computes hyperbolic cosine of values in ``input``. + """Computes hyperbolic cosine of values in `input`. :rtype: TensorList of cosh(input). If input is an integer, the result will be float, otherwise the type is preserved. @@ -203,7 +203,7 @@ def cosh(input) -> _DataNode: def tanh(input) -> _DataNode: - """Computes hyperbolic tangent of values in ``input``. + """Computes hyperbolic tangent of values in `input`. :rtype: TensorList of tanh(input). If input is an integer, the result will be float, otherwise the type is preserved. @@ -212,7 +212,7 @@ def tanh(input) -> _DataNode: def asinh(input) -> _DataNode: - """Computes inverse hyperbolic sine of values in ``input``. + """Computes inverse hyperbolic sine of values in `input`. :rtype: TensorList of asinh(input). If input is an integer, the result will be float, otherwise the type is preserved. @@ -221,7 +221,7 @@ def asinh(input) -> _DataNode: def acosh(input) -> _DataNode: - """Computes inverse hyperbolic cosine of values in ``input``. + """Computes inverse hyperbolic cosine of values in `input`. :rtype: TensorList of acosh(input). If input is an integer, the result will be float, otherwise the type is preserved. @@ -230,7 +230,7 @@ def acosh(input) -> _DataNode: def atanh(input) -> _DataNode: - """Computes inverse hyperbolic tangent of values in ``input``. + """Computes inverse hyperbolic tangent of values in `input`. :rtype: TensorList of atanh(input). If input is an integer, the result will be float, otherwise the type is preserved. @@ -239,7 +239,7 @@ def atanh(input) -> _DataNode: def min(left, right) -> _DataNode: - """Computes minima of corresponding values in ``left`` and ``right``. + """Computes minima of corresponding values in `left` and `right`. :rtype: TensorList of the type that is calculated based on the type promotion rules. """ @@ -247,7 +247,7 @@ def min(left, right) -> _DataNode: def max(left, right) -> _DataNode: - """Computes maxima of corresponding values in ``left`` and ``right``. + """Computes maxima of corresponding values in `left` and `right`. :rtype: TensorList of the type that is calculated based on the type promotion rules. """ @@ -281,7 +281,7 @@ def atan2(x, y) -> _DataNode: def clamp(value, lo, hi) -> _DataNode: - """Produces a tensor of values from ``value`` clamped to the range ``[lo, hi]``. + """Produces a tensor of values from `value` clamped to the range ``[lo, hi]``. :rtype: TensorList of the type that is calculated based on the type promotion rules. """ diff --git a/dali/python/nvidia/dali/ops/_operators/compose.py b/dali/python/nvidia/dali/ops/_operators/compose.py index 6a0ad0baa80..9c8005f5d04 100644 --- a/dali/python/nvidia/dali/ops/_operators/compose.py +++ b/dali/python/nvidia/dali/ops/_operators/compose.py @@ -1,4 +1,4 @@ -# Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# Copyright (c) 2023-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -67,7 +67,7 @@ def Compose(op_list: List[Callable[..., Union[Sequence[_DataNode], _DataNode]]]) files, labels = fn.readers.caffe(path=caffe_db_folder, seed=1) pipe.set_outputs(decode_and_resize(files), labels) - If there's a transition from CPU to GPU in the middle of the ``op_list``, as is the case in this + If there's a transition from CPU to GPU in the middle of the `op_list`, as is the case in this example, ``Compose`` automatically arranges copying the data to GPU memory. diff --git a/dali/python/nvidia/dali/ops/_operators/python_function.pyi b/dali/python/nvidia/dali/ops/_operators/python_function.pyi index d3b2cb3108a..e776a8e5d04 100644 --- a/dali/python/nvidia/dali/ops/_operators/python_function.pyi +++ b/dali/python/nvidia/dali/ops/_operators/python_function.pyi @@ -1,4 +1,4 @@ -# Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# Copyright (c) 2023-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -63,10 +63,10 @@ class DLTensorPythonFunction: For the GPU operator, it is the user's responsibility to synchronize the device code with DALI. To synchronize the device code with DALI, synchronize DALI's work before the operator call - with the ``synchronize_stream`` flag (enabled by default) and ensure that the scheduled device + with the `synchronize_stream` flag (enabled by default) and ensure that the scheduled device tasks are finished in the operator call. The GPU code can be executed on the CUDA stream used by DALI, which can be obtained by calling the ``current_dali_stream()`` function. In this case, - the ``synchronize_stream`` flag can be set to False. + the `synchronize_stream` flag can be set to False. """ def __init__( @@ -165,10 +165,10 @@ def dl_tensor_python_function( For the GPU operator, it is the user's responsibility to synchronize the device code with DALI. To synchronize the device code with DALI, synchronize DALI's work before the operator call - with the ``synchronize_stream`` flag (enabled by default) and ensure that the scheduled device + with the `synchronize_stream` flag (enabled by default) and ensure that the scheduled device tasks are finished in the operator call. The GPU code can be executed on the CUDA stream used by DALI, which can be obtained by calling the ``current_dali_stream()`` function. In this case, - the ``synchronize_stream`` flag can be set to False. + the `synchronize_stream` flag can be set to False. """ # This is just a stub of the documentation, for details use help() or visit the html docs. ... @@ -194,10 +194,10 @@ def dl_tensor_python_function( For the GPU operator, it is the user's responsibility to synchronize the device code with DALI. To synchronize the device code with DALI, synchronize DALI's work before the operator call - with the ``synchronize_stream`` flag (enabled by default) and ensure that the scheduled device + with the `synchronize_stream` flag (enabled by default) and ensure that the scheduled device tasks are finished in the operator call. The GPU code can be executed on the CUDA stream used by DALI, which can be obtained by calling the ``current_dali_stream()`` function. In this case, - the ``synchronize_stream`` flag can be set to False. + the `synchronize_stream` flag can be set to False. """ # This is just a stub of the documentation, for details use help() or visit the html docs. ... diff --git a/dali/python/nvidia/dali/pipeline.py b/dali/python/nvidia/dali/pipeline.py index f2fbd10f059..be45118af55 100644 --- a/dali/python/nvidia/dali/pipeline.py +++ b/dali/python/nvidia/dali/pipeline.py @@ -112,7 +112,7 @@ class Pipeline(object): Dynamic executor allows to interleave CPU and GPU operators and to perform GPU to CPU copies. It also uses dynamic memory allocation for pipeline outputs and inter-operator buffers, which reduces memory consumption in complex pipelines. - When ``exec_dynamic`` is ``True``, ``exec_async`` and ``exec_pipelined`` must be left at + When `exec_dynamic` is ``True``, `exec_async` and `exec_pipelined` must be left at their default (``True``) values. bytes_per_sample : int, optional, default = 0 A hint for DALI for how much memory to use for its tensors. @@ -129,9 +129,9 @@ class Pipeline(object): enable_memory_stats : bool, optional, default = False If DALI should print operator output buffer statistics. Useful for `bytes_per_sample_hint` operator parameter. - This flag has no effect when ``exec_dynamic`` is ``True``. + This flag has no effect when `exec_dynamic` is ``True``. enable_checkpointing : bool, optional, default = False - If True, DALI will trace states of the operators. In that case, calling the ``checkpoint`` + If True, DALI will trace states of the operators. In that case, calling the `checkpoint` method returns serialized state of the pipeline. The same pipeline can be later rebuilt with the serialized state passed as the `checkpoint` parameter to resume running from the saved iteration. @@ -139,7 +139,7 @@ class Pipeline(object): More details can be found in `this documentation section `_. checkpoint : str, optional, default = None - Serialized checkpoint, received from ``checkpoint`` method. + Serialized checkpoint, received from `checkpoint` method. When pipeline is built, its state is restored from the `checkpoint` and the pipeline resumes execution from the saved iteration. @@ -172,7 +172,7 @@ class Pipeline(object): older version of Python you can provide external serialization package such as dill or cloudpickle that implements two methods: `dumps` and `loads` to make DALI use them to serialize external source callbacks. You can pass a module directly as - ``py_callback_pickler``:: + `py_callback_pickler`:: import dill @pipeline_def(py_callback_pickler=dill, ...) @@ -202,7 +202,7 @@ def create_pipeline(): The outputs, after each iteration, will be validated against the types you passed to this argument. If any output does not match the provided type, RuntimeError will be raised. - If the ``output_dtype`` value is a single value (not a list), it will be broadcast to the + If the `output_dtype` value is a single value (not a list), it will be broadcast to the number of outputs from the pipeline. output_ndim : int or list of ints, default = None With this argument, you may declare, how many dimensions you expect in the given output. @@ -213,7 +213,7 @@ def create_pipeline(): dimensionality of any output does not match the provided ``ndim``, RuntimeError will be raised. - If the ``output_ndim`` value is a single value (not a list), it will be broadcast to the + If the `output_ndim` value is a single value (not a list), it will be broadcast to the number of outputs from the pipeline.""" def __init__( @@ -1085,7 +1085,7 @@ def feed_input(self, data_node, data, layout=None, cuda_stream=None, use_copy_ke (i.e. everything in ``fn.inputs`` module) and the :meth:`fn.external_source`. In the case of the GPU input, the data must be modified on the same stream as the one - used by ``feed_input``. See ``cuda_stream`` parameter for details. + used by ``feed_input``. See `cuda_stream` parameter for details. In order to avoid stalls, the data should be provided ahead of time `prefetch_queue_depth` times. @@ -1106,15 +1106,15 @@ def feed_input(self, data_node, data, layout=None, cuda_stream=None, use_copy_ke * objects implementing ``__cuda_array_interface__`` * DALI ``TensorList`` or list of DALI ``Tensor`` objects - The data to be used as the output of the operator referred to by ``data_node``. + The data to be used as the output of the operator referred to by `data_node`. layout : string or ``None`` The description of the data layout (or empty string, if not specified). It should be a string of the length that matches the dimensionality of the data, batch dimension excluded. For a batch of channel-first images, this should be ``"CHW"``, for channel-last video it's ``"FHWC"`` and so on. - If ``data`` is a DALI ``TensorList`` or a list of DALI ``Tensor`` objects and ``layout`` - is ``None``, the layout is taken from ``data``. + If `data` is a DALI ``TensorList`` or a list of DALI ``Tensor`` objects and `layout` + is ``None``, the layout is taken from `data`. The layout of the data must be the same in each iteration. cuda_stream : optional, ``cudaStream_t`` or an object convertible to ``cudaStream_t``, @@ -1555,7 +1555,7 @@ def deserialize(cls, serialized_pipeline=None, filename=None, **kwargs): the pipeline. Refer to Pipeline constructor for full list of arguments. By default, the pipeline will be instantiated with the arguments from serialized pipeline. - Note, that ``serialized_pipeline`` and ``filename`` parameters are mutually exclusive + Note, that `serialized_pipeline` and `filename` parameters are mutually exclusive Parameters ---------- diff --git a/dali/python/nvidia/dali/plugin/base_iterator.py b/dali/python/nvidia/dali/plugin/base_iterator.py index 85cbdc1728c..27dd2b28fc6 100644 --- a/dali/python/nvidia/dali/plugin/base_iterator.py +++ b/dali/python/nvidia/dali/plugin/base_iterator.py @@ -93,7 +93,7 @@ class _DaliBaseIterator(object): is called internally automatically fill_last_batch : bool, optional, default = None - **Deprecated** Please use ``last_batch_policy`` instead + **Deprecated** Please use `last_batch_policy` instead Whether to fill the last batch with data up to 'self.batch_size'. The iterator would return the first integer multiple @@ -105,7 +105,7 @@ class _DaliBaseIterator(object): to fully fill it. See :meth:`nvidia.dali.plugin.base_iterator.LastBatchPolicy` last_batch_padded : bool, optional, default = False Whether the last batch provided by DALI is padded with the last sample - or it just wraps up. In the conjunction with ``last_batch_policy`` it tells + or it just wraps up. In the conjunction with `last_batch_policy` it tells if the iterator returning last batch with data only partially filled with data from the current epoch is dropping padding samples or samples from the next epoch. If set to False next diff --git a/dali/python/nvidia/dali/plugin/jax/clu.py b/dali/python/nvidia/dali/plugin/jax/clu.py index 23808f531b6..14ad6574749 100644 --- a/dali/python/nvidia/dali/plugin/jax/clu.py +++ b/dali/python/nvidia/dali/plugin/jax/clu.py @@ -86,7 +86,7 @@ class DALIGenericPeekableIterator(DALIGenericIterator): JAX iterator does not support LastBatchPolicy.PARTIAL last_batch_padded : bool, optional, default = False Whether the last batch provided by DALI is padded with the last sample - or it just wraps up. In the conjunction with ``last_batch_policy`` it tells + or it just wraps up. In the conjunction with `last_batch_policy` it tells if the iterator returning last batch with data only partially filled with data from the current epoch is dropping padding samples or samples from the next epoch. If set to ``False`` next @@ -340,7 +340,7 @@ def peekable_data_iterator( JAX iterator does not support LastBatchPolicy.PARTIAL last_batch_padded : bool, optional, default = False Whether the last batch provided by DALI is padded with the last sample - or it just wraps up. In the conjunction with ``last_batch_policy`` it tells + or it just wraps up. In the conjunction with `last_batch_policy` it tells if the iterator returning last batch with data only partially filled with data from the current epoch is dropping padding samples or samples from the next epoch. If set to ``False`` next diff --git a/dali/python/nvidia/dali/plugin/jax/fn/_jax_function_impl.py b/dali/python/nvidia/dali/plugin/jax/fn/_jax_function_impl.py index 06caa66bbec..213db1ab5be 100644 --- a/dali/python/nvidia/dali/plugin/jax/fn/_jax_function_impl.py +++ b/dali/python/nvidia/dali/plugin/jax/fn/_jax_function_impl.py @@ -67,7 +67,7 @@ def jax_function( preserve: bool = True, ) -> DaliCallback: """ - Transforms the Python function ``function`` that processes ``jax.Array`` objects into + Transforms the Python function `function` that processes ``jax.Array`` objects into DALI operator that can be used inside DALI pipeline definition or JAX plugin iterator definition. The transformed function accepts and returns the same number of inputs and outputs as the @@ -92,7 +92,7 @@ def pipeline(): flipped = flip_horizontal(image) return image, flipped - The ``function`` can be transformed with usual JAX transformations, for example + The `function` can be transformed with usual JAX transformations, for example we can utilize JAX's just-in-time compilation and vectorization adding the appropriate decorators in the above example:: @@ -106,8 +106,8 @@ def flip_horizontal(image: jax.Array): streams will be synchronized. The JAX operations do not need to be further synchronized by the user. - The ``jax.Arrays`` passed to the ``function`` must not be accessed after the - ``function`` completes (for example, they should not be stored in some non-local scope). + The ``jax.Arrays`` passed to the `function` must not be accessed after the + `function` completes (for example, they should not be stored in some non-local scope). .. note:: @@ -127,26 +127,26 @@ def flip_horizontal(image: jax.Array): For this reason, the transformed function can only receive DALI batches that contain samples of uniform shape. num_outputs : int, default=1 - The number of outputs returned by the ``function``. + The number of outputs returned by the `function`. Function can return no output, in that case the `num_outputs` must be set to 0. - If the ``num_outputs`` is 1 (the default), callback should return a single JAX array, - for ``num_outputs`` > 1, callback should return a tuple of JAX arrays. + If the `num_outputs` is 1 (the default), callback should return a single JAX array, + for `num_outputs` > 1, callback should return a tuple of JAX arrays. output_layouts: Union[str, Tuple[str]], optional The layouts of returned tensors. - It can be either a list of strings for all of ``num_outputs`` respective outputs + It can be either a list of strings for all of `num_outputs` respective outputs or a single string to be set to all of the outputs. Please note, in DALI, the outermost batch extent is implicit, the layout should take into account only the sample dimensions. - If the argument is not specified and the ``function``'s i-th output has the same + If the argument is not specified and the `function`'s i-th output has the same dimensionality as the i-th input, the layout will be propagated from the input to the corresponding output. sharding: jax.sharding.Sharding, optional The JAX sharding object (either ``PositionalSharding`` or ``NamedSharding``). - If specified, the ``jax.Arrays`` passed to the ``function`` will be a global + If specified, the ``jax.Arrays`` passed to the `function` will be a global ``jax.Array`` aware of the sharding. .. note:: diff --git a/dali/python/nvidia/dali/plugin/jax/iterator.py b/dali/python/nvidia/dali/plugin/jax/iterator.py index 3d9632d2b94..26a9fa53eb5 100644 --- a/dali/python/nvidia/dali/plugin/jax/iterator.py +++ b/dali/python/nvidia/dali/plugin/jax/iterator.py @@ -70,7 +70,7 @@ class DALIGenericIterator(_DaliBaseIterator): JAX iterator does not support LastBatchPolicy.PARTIAL last_batch_padded : bool, optional, default = False Whether the last batch provided by DALI is padded with the last sample - or it just wraps up. In the conjunction with ``last_batch_policy`` it tells + or it just wraps up. In the conjunction with `last_batch_policy` it tells if the iterator returning last batch with data only partially filled with data from the current epoch is dropping padding samples or samples from the next epoch. If set to ``False`` next @@ -442,7 +442,7 @@ def data_iterator( JAX iterator does not support LastBatchPolicy.PARTIAL last_batch_padded : bool, optional, default = False Whether the last batch provided by DALI is padded with the last sample - or it just wraps up. In the conjunction with ``last_batch_policy`` it tells + or it just wraps up. In the conjunction with `last_batch_policy` it tells if the iterator returning last batch with data only partially filled with data from the current epoch is dropping padding samples or samples from the next epoch. If set to ``False`` next diff --git a/dali/python/nvidia/dali/plugin/paddle.py b/dali/python/nvidia/dali/plugin/paddle.py index 8c17b6de807..2da56cc59b1 100644 --- a/dali/python/nvidia/dali/plugin/paddle.py +++ b/dali/python/nvidia/dali/plugin/paddle.py @@ -173,7 +173,7 @@ class DALIGenericIterator(_DaliBaseIterator): dynamic_shape : any, optional, Parameter used only for backward compatibility. fill_last_batch : bool, optional, default = None - **Deprecated** Please use ``last_batch_policy`` instead + **Deprecated** Please use `last_batch_policy` instead Whether to fill the last batch with data up to 'self.batch_size'. The iterator would return the first integer multiple @@ -185,7 +185,7 @@ class DALIGenericIterator(_DaliBaseIterator): to fully fill it. See :meth:`nvidia.dali.plugin.base_iterator.LastBatchPolicy` last_batch_padded : bool, optional, default = False Whether the last batch provided by DALI is padded with the last sample - or it just wraps up. In the conjunction with ``last_batch_policy`` it tells + or it just wraps up. In the conjunction with `last_batch_policy` it tells if the iterator returning last batch with data only partially filled with data from the current epoch is dropping padding samples or samples from the next epoch. If set to ``False`` next @@ -439,7 +439,7 @@ class DALIClassificationIterator(DALIGenericIterator): dynamic_shape : any, optional, Parameter used only for backward compatibility. fill_last_batch : bool, optional, default = None - **Deprecated** Please use ``last_batch_policy`` instead + **Deprecated** Please use `last_batch_policy` instead Whether to fill the last batch with data up to 'self.batch_size'. The iterator would return the first integer multiple @@ -451,7 +451,7 @@ class DALIClassificationIterator(DALIGenericIterator): to fully fill it. See :meth:`nvidia.dali.plugin.base_iterator.LastBatchPolicy` last_batch_padded : bool, optional, default = False Whether the last batch provided by DALI is padded with the last sample - or it just wraps up. In the conjunction with ``last_batch_policy`` it tells + or it just wraps up. In the conjunction with `last_batch_policy` it tells if the iterator returning last batch with data only partially filled with data from the current epoch is dropping padding samples or samples from the next epoch. If set to ``False`` next diff --git a/dali/python/nvidia/dali/plugin/pytorch/__init__.py b/dali/python/nvidia/dali/plugin/pytorch/__init__.py index dc628a1c601..50d5827b484 100644 --- a/dali/python/nvidia/dali/plugin/pytorch/__init__.py +++ b/dali/python/nvidia/dali/plugin/pytorch/__init__.py @@ -140,7 +140,7 @@ class DALIGenericIterator(_DaliBaseIterator): dynamic_shape : any, optional, Parameter used only for backward compatibility. fill_last_batch : bool, optional, default = None - **Deprecated** Please use ``last_batch_policy`` instead + **Deprecated** Please use `last_batch_policy` instead Whether to fill the last batch with data up to 'self.batch_size'. The iterator would return the first integer multiple @@ -152,7 +152,7 @@ class DALIGenericIterator(_DaliBaseIterator): to fully fill it. See :meth:`nvidia.dali.plugin.base_iterator.LastBatchPolicy` last_batch_padded : bool, optional, default = False Whether the last batch provided by DALI is padded with the last sample - or it just wraps up. In the conjunction with ``last_batch_policy`` it tells + or it just wraps up. In the conjunction with `last_batch_policy` it tells if the iterator returning last batch with data only partially filled with data from the current epoch is dropping padding samples or samples from the next epoch. If set to ``False`` next @@ -392,7 +392,7 @@ class DALIClassificationIterator(DALIGenericIterator): dynamic_shape : any, optional, Parameter used only for backward compatibility. fill_last_batch : bool, optional, default = None - **Deprecated** Please use ``last_batch_policy`` instead + **Deprecated** Please use `last_batch_policy` instead Whether to fill the last batch with data up to 'self.batch_size'. The iterator would return the first integer multiple @@ -404,7 +404,7 @@ class DALIClassificationIterator(DALIGenericIterator): to fully fill it. See :meth:`nvidia.dali.plugin.base_iterator.LastBatchPolicy` last_batch_padded : bool, optional, default = False Whether the last batch provided by DALI is padded with the last sample - or it just wraps up. In the conjunction with ``last_batch_policy`` it tells + or it just wraps up. In the conjunction with `last_batch_policy` it tells if the iterator returning last batch with data only partially filled with data from the current epoch is dropping padding samples or samples from the next epoch. If set to ``False`` next @@ -519,7 +519,7 @@ class DALIRaggedIterator(_DaliBaseIterator): is called internally automatically fill_last_batch : bool, optional, default = None - **Deprecated** Please use ``last_batch_policy`` instead + **Deprecated** Please use `last_batch_policy` instead Whether to fill the last batch with data up to 'self.batch_size'. The iterator would return the first integer multiple @@ -531,7 +531,7 @@ class DALIRaggedIterator(_DaliBaseIterator): to fully fill it. See :meth:`nvidia.dali.plugin.base_iterator.LastBatchPolicy` last_batch_padded : bool, optional, default = False Whether the last batch provided by DALI is padded with the last sample - or it just wraps up. In the conjunction with ``last_batch_policy`` it tells + or it just wraps up. In the conjunction with `last_batch_policy` it tells if the iterator returning last batch with data only partially filled with data from the current epoch is dropping padding samples or samples from the next epoch (it doesn't literally drop but sets ``pad`` field of ndarray diff --git a/dali/python/nvidia/dali/plugin/tf.py b/dali/python/nvidia/dali/plugin/tf.py index 4a9fb3a66d6..1371c200c5f 100644 --- a/dali/python/nvidia/dali/plugin/tf.py +++ b/dali/python/nvidia/dali/plugin/tf.py @@ -54,7 +54,7 @@ Each of the input datasets must be mapped to a :meth:`~nvidia.dali.fn.external_source` operator that will represent the input to the DALI pipeline. In the pipeline the input is represented as the ``name`` parameter of :meth:`~nvidia.dali.fn.external_source`. Input datasets must be provided -as a mapping from that ``name`` to the dataset object via the ``input_datasets`` dictionary +as a mapping from that ``name`` to the dataset object via the `input_datasets` dictionary argument of DALIDatasetWithInputs. **Per-sample and batch mode** @@ -71,7 +71,7 @@ In both cases (per-sample and batch mode), the layout of those inputs should be denoted as "HWC". -In per-sample mode DALIDataset will query the inputs dataset ``batch_size``-times to build a batch +In per-sample mode DALIDataset will query the inputs dataset `batch_size`-times to build a batch that would be fed into the DALI Pipeline. In per-sample mode, each sample produced by the input dataset can have a different shape, but the number of dimension and the layout must remain constant. @@ -115,7 +115,7 @@ .. note:: Parallel execution of external source callback provided via ``source`` is not supported. The callback is executed via TensorFlow ``tf.data.Dataset.from_generator`` - the ``parallel`` - and ``prefetch_queue_depth`` parameters are ignored. + and `prefetch_queue_depth` parameters are ignored. The operator adds additional parameters to the ones supported by the @@ -136,7 +136,7 @@ 'generator_input': tf.data.Dataset.from_generator(some_generator) } - can be passed as ``input_datasets`` for Pipeline like:: + can be passed as `input_datasets` for Pipeline like:: @pipeline_def def external_source_pipe(): @@ -970,11 +970,11 @@ def __init__(self, *args, **kwargs): output_dtypes: tf.DType or tuple of tf.DType, default = None expected output types output_shapes: tuple of shapes, optional, default = None - expected output shapes. If provided, must match arity of the ``output_dtypes``. + expected output shapes. If provided, must match arity of the `output_dtypes`. When set to None, DALI will infer the shapes on its own. Individual shapes can be also set to None or contain None to indicate unknown dimensions. If specified must be compatible with shape returned from DALI Pipeline - and with ``batch_size`` argument which will be the outermost dimension of returned tensors. + and with `batch_size` argument which will be the outermost dimension of returned tensors. In case of ``batch_size = 1`` it can be omitted in the shape. DALI Dataset will try to match requested shape by squeezing 1-sized dimensions from shape obtained from Pipeline. @@ -1000,22 +1000,22 @@ def __init__(self, *args, **kwargs): exec_dynamic : bool, optional, default = False Whether to execute the pipeline with the dynamic executor, which allows flexible mixing of CPU and GPU operators and enables aggressive memory reuse. - This flag is incompatible with ``exec_separated``. + This flag is incompatible with `exec_separated`. prefetch_queue_depth : int, optional, default = 2 depth of the executor queue. Deeper queue makes DALI more resistant to uneven execution time of each batch, but it also consumes more memory for internal buffers. - Value will be used with ``exec_separated`` set to ``False``. + Value will be used with `exec_separated` set to ``False``. cpu_prefetch_queue_depth : int, optional, default = 2 depth of the executor cpu queue. Deeper queue makes DALI more resistant to uneven execution time of each batch, but it also consumes more memory for internal buffers. - Value will be used with ``exec_separated`` set to ``True``. + Value will be used with `exec_separated` set to ``True``. gpu_prefetch_queue_depth : int, optional, default = 2 depth of the executor gpu queue. Deeper queue makes DALI more resistant to uneven execution time of each batch, but it also consumes more memory for internal buffers. - Value will be used with ``exec_separated`` set to ``True``. + Value will be used with `exec_separated` set to ``True``. Returns ------- diff --git a/dali/test/python/operator_2/test_squeeze.py b/dali/test/python/operator_2/test_squeeze.py index 2cce93e4a64..69fd766c69e 100644 --- a/dali/test/python/operator_2/test_squeeze.py +++ b/dali/test/python/operator_2/test_squeeze.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# Copyright (c) 2021-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -116,7 +116,7 @@ def test_squeeze_throw_error(): "Requested a shape with 100 elements but the original shape has 1000 elements.", "Axis 'C' is not present in the input layout", "Requested a shape with 1 elements but the original shape has 10 elements.", - "Provided both ``axes`` and ``axis_names`` arguments", + "Provided both ``axes`` and `axis_names` arguments", "Requested a shape with 100 elements but the original shape has 0 elements.", "Specified at least twice same dimension to remove.", ] From 4bbfe193ee86255da3097916c64a940d0eb17c9e Mon Sep 17 00:00:00 2001 From: Krzysztof Lecki Date: Tue, 19 Nov 2024 20:45:07 +0100 Subject: [PATCH 2/4] Some clean-up Signed-off-by: Krzysztof Lecki --- dali/operators/bbox/bb_flip.cc | 4 ++-- dali/operators/bbox/bbox_paste.cc | 2 +- dali/operators/decoder/image_decoder.cc | 2 +- dali/operators/generic/erase/erase.cc | 6 +++--- dali/operators/generic/reshape.cc | 4 ++-- dali/operators/generic/slice/slice.cc | 6 +++--- dali/operators/generic/squeeze.cc | 4 ++-- dali/operators/image/convolution/gaussian_blur.cc | 2 +- dali/operators/image/crop/bbox_crop.cc | 8 ++++---- dali/operators/image/resize/resize_crop_mirror.cc | 2 +- dali/operators/imgcodec/decoder_schema.cc | 2 +- dali/test/python/operator_2/test_squeeze.py | 2 +- 12 files changed, 22 insertions(+), 22 deletions(-) diff --git a/dali/operators/bbox/bb_flip.cc b/dali/operators/bbox/bb_flip.cc index 78709eda054..ee451cf659f 100644 --- a/dali/operators/bbox/bb_flip.cc +++ b/dali/operators/bbox/bb_flip.cc @@ -25,12 +25,12 @@ DALI_SCHEMA(BbFlip) .DocStr(R"code(Flips bounding boxes horizontally or vertically (mirror). The bounding box coordinates for the input are in the [x, y, width, height] - ``xywh`` or -[left, top, right, bottom] - `ltrb` format. All coordinates are in the image coordinate +[left, top, right, bottom] - ``ltrb`` format. All coordinates are in the image coordinate system, that is 0.0-1.0)code") .NumInput(1) .NumOutput(1) .AddOptionalArg("ltrb", - R"code(True for `ltrb` or False for ``xywh``.)code", + R"code(True for ``ltrb`` or False for ``xywh``.)code", false, false) .AddOptionalArg("horizontal", R"code(Flip horizontal dimension.)code", diff --git a/dali/operators/bbox/bbox_paste.cc b/dali/operators/bbox/bbox_paste.cc index f5da637cbec..b67b0e3ba06 100644 --- a/dali/operators/bbox/bbox_paste.cc +++ b/dali/operators/bbox/bbox_paste.cc @@ -45,7 +45,7 @@ canvas and ``(1,1)`` aligns it to bottom-right. R"code(Ratio of the canvas size to the input size; the value must be at least 1.)code", DALI_FLOAT, true) .AddOptionalArg("ltrb", - R"code(True for `ltrb` or False for ``xywh``.)code", + R"code(True for ``ltrb`` or False for ``xywh``.)code", false, false) .AddOptionalArg("paste_x", R"code(Horizontal position of the paste in image coordinates (0.0 - 1.0).)code", diff --git a/dali/operators/decoder/image_decoder.cc b/dali/operators/decoder/image_decoder.cc index 1556d0438c3..09b137d9c0b 100644 --- a/dali/operators/decoder/image_decoder.cc +++ b/dali/operators/decoder/image_decoder.cc @@ -265,7 +265,7 @@ The slice can be configured by providing start and end coordinates or start and Relative and absolute arguments can be mixed (for example, `rel_start` can be used with `shape`) as long as start and shape or end are uniquely defined. -Alternatively, two extra positional inputs can be provided, specifying ``anchor`` and `shape`. +Alternatively, two extra positional inputs can be provided, specifying `__anchor` and `__shape`. When using positional inputs, two extra boolean arguments `normalized_anchor`/`normalized_shape` can be used to specify the nature of the arguments provided. Using positional inputs for anchor and shape is incompatible with the named arguments specified above. diff --git a/dali/operators/generic/erase/erase.cc b/dali/operators/generic/erase/erase.cc index 9d7bc7a2aba..ebb9ca90b34 100644 --- a/dali/operators/generic/erase/erase.cc +++ b/dali/operators/generic/erase/erase.cc @@ -32,9 +32,9 @@ DALI_SCHEMA(Erase) The region is specified by an `anchor` (starting point) and a `shape` (dimensions). Only the relevant dimensions are specified. Not specified dimensions are treated as if the entire range of the axis was provided. -To specify multiple regions, `anchor` and `shape`.represent multiple points consecutively -(for example, `anchor` = (y0, x0, y1, x1, ...) and `shape`.= (h0, w0, h1, w1, ...)). -The `anchor` and `shape`.arguments are interpreted based on the value of the `axis_names` +To specify multiple regions, `anchor` and `shape` represent multiple points consecutively +(for example, `anchor` = (y0, x0, y1, x1, ...) and `shape` = (h0, w0, h1, w1, ...)). +The `anchor` and `shape` arguments are interpreted based on the value of the `axis_names` argument, or, alternatively, the value of the `axes` argument. If no `axis_names` or `axes` arguments are provided, all dimensions except ``C`` (channels) must be specified. diff --git a/dali/operators/generic/reshape.cc b/dali/operators/generic/reshape.cc index f7edc739135..89048555284 100644 --- a/dali/operators/generic/reshape.cc +++ b/dali/operators/generic/reshape.cc @@ -44,7 +44,7 @@ For example, an input of shape ``[480, 640, 3]`` and ``shape = [240, -1]`` results in the output shape ``[240, 3840]``. .. note:: - `rel_shape` and `shape`.are mutually exclusive. + `rel_shape` and `shape` are mutually exclusive. )code", std::vector(), true) .AddOptionalArg("rel_shape", R"code(The relative shape of the output. @@ -71,7 +71,7 @@ The number of dimensions is subject to the following restrictions: the end will be added .. note:: - `rel_shape` and `shape`.are mutually exclusive. + `rel_shape` and `shape` are mutually exclusive. )code", std::vector(), true) .AddOptionalArg("layout", R"code(New layout for the data. diff --git a/dali/operators/generic/slice/slice.cc b/dali/operators/generic/slice/slice.cc index 8787dc391d2..e9af56c253f 100644 --- a/dali/operators/generic/slice/slice.cc +++ b/dali/operators/generic/slice/slice.cc @@ -41,17 +41,17 @@ The slice can be configured by providing start and end coordinates or start and Relative and absolute arguments can be mixed (for example, `rel_start` can be used with `shape`) as long as start and shape or end are uniquely defined. -Alternatively, two extra positional inputs can be provided, specifying ``anchor`` and `shape`. +Alternatively, two extra positional inputs can be provided, specifying `__anchor` and `__shape`. When using positional inputs, two extra boolean arguments `normalized_anchor`/`normalized_shape` can be used to specify the nature of the arguments provided. Using positional inputs for anchor and shape is incompatible with the named arguments specified above. .. note:: - For GPU backend and positional inputs ``anchor`` and `shape`. both CPU and GPU data nodes + For GPU backend and positional inputs `__anchor` and `shape`, both CPU and GPU data nodes are accepted, though CPU inputs are preferred. Providing those arguments as GPU inputs will result in an additional device-to-host copy with its associated synchronization point. - When possible, provide ``anchor`` and `shape`.as CPU inputs. + When possible, provide `__anchor` and `shape` as CPU inputs. The slice arguments should provide as many dimensions as specified by the `axis_names` or `axes` arguments. diff --git a/dali/operators/generic/squeeze.cc b/dali/operators/generic/squeeze.cc index 00871ae9445..418732bc883 100644 --- a/dali/operators/generic/squeeze.cc +++ b/dali/operators/generic/squeeze.cc @@ -50,8 +50,8 @@ Squeeze::Squeeze(const OpSpec &spec) axis_names_ = spec.GetArgument("axis_names"); DALI_ENFORCE(spec.HasArgument("axes") + spec.HasArgument("axis_names") == 1, - spec.HasArgument("axes") ? "Provided both `axes` and `axis_names` arguments" - : "Missing argument `axes` or `axis_names`."); + spec.HasArgument("axes") ? "Provided both ``axes`` and ``axis_names`` arguments" + : "Missing argument ``axes`` or ``axis_names``."); this->use_src_dims_ = true; } diff --git a/dali/operators/image/convolution/gaussian_blur.cc b/dali/operators/image/convolution/gaussian_blur.cc index 338ae919a85..f183587bc5f 100644 --- a/dali/operators/image/convolution/gaussian_blur.cc +++ b/dali/operators/image/convolution/gaussian_blur.cc @@ -34,7 +34,7 @@ DALI_SCHEMA(GaussianBlur) .DocStr(R"code(Applies a Gaussian Blur to the input. Gaussian blur is calculated by applying a convolution with a Gaussian kernel, which can be -parameterized with ``windows_size`` and `sigma`. +parameterized with `windows_size` and `sigma`. If only the sigma is specified, the radius of the Gaussian kernel defaults to ``ceil(3 * sigma)``, so the kernel window size is ``2 * ceil(3 * sigma) + 1``. diff --git a/dali/operators/image/crop/bbox_crop.cc b/dali/operators/image/crop/bbox_crop.cc index d4d243f879e..04fffe0b118 100644 --- a/dali/operators/image/crop/bbox_crop.cc +++ b/dali/operators/image/crop/bbox_crop.cc @@ -158,17 +158,17 @@ the bounding boxes. **Outputs: 0**: anchor, 1: shape, 2: bboxes (, 3: labels, 4: bboxes_indices) -The resulting crop parameters are provided as two separate outputs, ``anchor`` and `shape`. +The resulting crop parameters are provided as two separate outputs, `anchor` and `shape` that can be fed directly to the :meth:`nvidia.dali.fn.slice` operator to complete the cropping -of the original image. ``anchor`` and `shape`.contain the starting coordinates and dimensions +of the original image. `anchor` and `shape` contain the starting coordinates and dimensions for the crop in the ``[x, y, (z)]`` and ``[w, h, (d)]`` formats, respectively. The coordinates can be represented in absolute or relative terms, and the representation depends on whether the fixed `crop_shape` was used. .. note:: - Both ``anchor`` and `shape`.are returned as a ``float``, even if they represent absolute + Both `anchor` and `shape` are returned as a ``float``, even if they represent absolute coordinates due to providing `crop_shape` argument. In order for them to be interpreted - correctly by :meth:`nvidia.dali.fn.slice`, ``normalized_anchor`` and ``normalized_shape`` + correctly by :meth:`nvidia.dali.fn.slice`, `normalized_anchor` and `normalized_shape` should be set to False. diff --git a/dali/operators/image/resize/resize_crop_mirror.cc b/dali/operators/image/resize/resize_crop_mirror.cc index 20d94689e79..f8d04f43a25 100755 --- a/dali/operators/image/resize/resize_crop_mirror.cc +++ b/dali/operators/image/resize/resize_crop_mirror.cc @@ -33,7 +33,7 @@ Supported values: DALI_SCHEMA(ResizeCropMirror) .DocStr(R"(Performs a fused resize, crop, mirror operation. -The result of the operation is equivalent to applying ``resize``, followed by `crop` and ``flip``. +The result of the operation is equivalent to applying ``resize``, followed by ``crop`` and ``flip``. Internally, the operator calculates the relevant region of interest and performs a single resizing operation on that region. .)") diff --git a/dali/operators/imgcodec/decoder_schema.cc b/dali/operators/imgcodec/decoder_schema.cc index c9779c398d3..a41acaf56b7 100644 --- a/dali/operators/imgcodec/decoder_schema.cc +++ b/dali/operators/imgcodec/decoder_schema.cc @@ -217,7 +217,7 @@ The slice can be configured by providing start and end coordinates or start and Relative and absolute arguments can be mixed (for example, `rel_start` can be used with `shape`) as long as start and shape or end are uniquely defined. -Alternatively, two extra positional inputs can be provided, specifying ``anchor`` and `shape`. +Alternatively, two extra positional inputs can be provided, specifying `__anchor` and `__shape`. When using positional inputs, two extra boolean arguments `normalized_anchor`/`normalized_shape` can be used to specify the nature of the arguments provided. Using positional inputs for anchor and shape is incompatible with the named arguments specified above. diff --git a/dali/test/python/operator_2/test_squeeze.py b/dali/test/python/operator_2/test_squeeze.py index 69fd766c69e..8b2ca19591e 100644 --- a/dali/test/python/operator_2/test_squeeze.py +++ b/dali/test/python/operator_2/test_squeeze.py @@ -116,7 +116,7 @@ def test_squeeze_throw_error(): "Requested a shape with 100 elements but the original shape has 1000 elements.", "Axis 'C' is not present in the input layout", "Requested a shape with 1 elements but the original shape has 10 elements.", - "Provided both ``axes`` and `axis_names` arguments", + "Provided both ``axes`` and ``axis_names`` arguments", "Requested a shape with 100 elements but the original shape has 0 elements.", "Specified at least twice same dimension to remove.", ] From 637947dc902eb7664c4fd00861d84f80156cf6cf Mon Sep 17 00:00:00 2001 From: Krzysztof Lecki Date: Wed, 20 Nov 2024 12:58:37 +0100 Subject: [PATCH 3/4] Minor fix Signed-off-by: Krzysztof Lecki --- dali/operators/generic/slice/slice.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dali/operators/generic/slice/slice.cc b/dali/operators/generic/slice/slice.cc index e9af56c253f..484ecb4ce27 100644 --- a/dali/operators/generic/slice/slice.cc +++ b/dali/operators/generic/slice/slice.cc @@ -47,11 +47,11 @@ can be used to specify the nature of the arguments provided. Using positional in and shape is incompatible with the named arguments specified above. .. note:: - For GPU backend and positional inputs `__anchor` and `shape`, both CPU and GPU data nodes + For GPU backend and positional inputs `__anchor` and `__shape`, both CPU and GPU data nodes are accepted, though CPU inputs are preferred. Providing those arguments as GPU inputs will result in an additional device-to-host copy with its associated synchronization point. - When possible, provide `__anchor` and `shape` as CPU inputs. + When possible, provide `__anchor` and `__shape` as CPU inputs. The slice arguments should provide as many dimensions as specified by the `axis_names` or `axes` arguments. From 6a86889c8de38ceec652837338249ece98e1a9d1 Mon Sep 17 00:00:00 2001 From: Krzysztof Lecki Date: Fri, 22 Nov 2024 19:22:20 +0100 Subject: [PATCH 4/4] Small fix Signed-off-by: Krzysztof Lecki --- dali/test/python/test_pipeline.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/dali/test/python/test_pipeline.py b/dali/test/python/test_pipeline.py index 4437b7d9e61..ce63ded696a 100644 --- a/dali/test/python/test_pipeline.py +++ b/dali/test/python/test_pipeline.py @@ -1806,8 +1806,7 @@ def test_output_dtype_deprecation(): assert len(w) == 1 assert issubclass(w[-1].category, DeprecationWarning) expected_msg = ( - "The argument ``output_dtype`` is a deprecated alias for ``dtype``. " - "Use ``dtype`` instead." + "The argument `output_dtype` is a deprecated alias for `dtype`. Use `dtype` instead." ) assert expected_msg == str(w[-1].message) @@ -1822,7 +1821,7 @@ def test_image_type_deprecation(): assert len(w) == 1 assert issubclass(w[-1].category, DeprecationWarning) expected_msg = ( - "The argument ``image_type`` is no longer used and will be removed " + "The argument `image_type` is no longer used and will be removed " "in a future release." ) assert expected_msg == str(w[-1].message)