- nvidia.dali.fn.experimental.filter(*inputs, **kwargs)¶
Convolves the image with the provided filter.
In fact, the operator computes a correlation, not a convolution, i.e. the order of filter elements is not flipped when computing the product of the filter and the image.
This operator allows sequence inputs.
- Supported backends
data (TensorList) –
Batch of input samples.
Sample can be an image, a video or volumetric (3D) data. Samples can contain channels: channel-first and channel-last layouts are supported. In case of video/sequences, the frame extent must preced the channels extent, i.e., for example, a video with
"FCHW"layout is supported, but
"CFHW"samples are not.
Samples with the following types are supported: int8, int16, uint8, uint16, float16, float32.
Please note that the intermediate type used for the computation is always float32.
The CPU variant does not support volumetric (3D) data, nor inputs of types: int8 and float16.
filter (TensorList) –
Batch of filters.
For inputs with two spatial dimensions (images or video), each filter must be a 2D array (or a sequence of 2D arrays to be applied
per-frameto a video input). For volumetric inputs, the filter must be a 3D array. The filter values must have float32 type.
fill_value (TensorList, optional) –
Batch of scalars used for padding.
"border"is set to
"constant", the input samples will be padded with the corresponding scalars when convolved with the filter. The scalars must be of the same type as the input samples. For video/sequence input, an array of scalars can be specified to be applied
- Keyword Arguments:
anchor (int or list of int or TensorList of int, optional, default = [-1]) –
Specifies the position of the filter over the input.
If the filter size is
(r, s)and the anchor is
(a, b), the output at position
(x, y)is a product of the filter and the input rectangle spanned between the corners: top-left
(x - a, y - b)and bottom-right
(x - a + r - 1, x - b + s - 1).
If the -1 (the default) is specifed, the middle (rounded down to integer) of the filter extents is used, which, for odd sized filters, results in the filter centered over the input.
The anchor must be, depending on the input dimensionality, a 2D or 3D point whose each extent lies within filter boundaries (
[0, ..., filter_extent - 1]). The ordering of anchor’s extents corresponds to the order of filter’s extents.
The parameter is ignored in
border (str, optional, default = ‘reflect_101’) –
Controls how to handle out-of-bound filter positions over the sample.
Supported values are:
"reflect_101"(default), reflects the input but does not repeat the outermost values (
"reflect_1001": reflects the input including outermost values (
"wrap": wraps the input (
"clamp": the input is padded with outermost values (
"constant": the input is padded with the user-provided scalar (zeros by default). within the sample.
bytes_per_sample_hint (int or list of int, optional, default = ) –
Output size hint, in bytes per sample.
If specified, the operator’s outputs residing in GPU or page-locked host memory will be preallocated to accommodate a batch of samples of this size.
nvidia.dali.types.DALIDataType, optional) –
Output data type. The output type can either be float or must be same as input type. If not set, the input type is used.
The intermediate type used for actual computation is float32. If the output is of integral type, the values will be clamped to the output type range.
mode (str, optional, default = ‘same’) –
Supported values are:
"same"(default): The input and output sizes are the same and
borderis 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.
preserve (bool, optional, default = False) – Prevents the operator from being removed from the graph even if its outputs are not used.
seed (int, optional, default = -1) –
If not provided, it will be populated based on the global seed of the pipeline.