conv#

ivy.conv(x, filters, strides, padding, /, *, transpose=False, dims=2, output_shape=None, data_format='channel_last', filter_format='channel_last', feature_group_count=1, x_dilations=1, dilations=1, bias=None, out=None)[source]#

Compute a 1-D, 2-D, and 3-D transpose or dilated convolution given 3-D, 4-D and 5-D input x respectively and filters arrays.

Parameters:
  • x (Union[Array, NativeArray]) – Input image [batch_size,d,h,w,d_in] or [batch_size,d_in,d,h,w].

  • filters (Union[Array, NativeArray]) – Convolution filters [fd,fh,fw,d_in/feature_group_count,d_out].

  • strides (Union[int, Tuple[int], Tuple[int, int], Tuple[int, int, int]]) – The stride of the sliding window for each dimension of input.

  • padding (Union[str, Sequence[Tuple[int, int]]]) – either the string ‘SAME’ (padding with zeros evenly), the string ‘VALID’ (no padding), or a sequence of n (low, high) integer pairs that give the padding to apply before and after each spatial dimension.

  • transpose (bool) – True for computing transpose convolution, and False for dilated convolution. (default: False) When True, x_dilations must be 1 (the default).

  • dims (int) – Either 1, 2, or 3 corresponding to 1-D, 2-D, and 3-D convolution. (default: 2)

  • output_shape (Optional[Union[Shape, NativeShape]]) – Shape of the output (Default value = None) (default: None)

  • data_format (str) – Either “channel_first” or “channel_last”. “channel_first” corresponds to “NCW”, (default: 'channel_last') “NCHW”, “NCDHW” input data formatS for 1-D, 2-D, 3-D convolution respectively, while “channel_last” corresponds to “NWC”, “NHWC”, “NDHWC” respectively.

  • filter_format (str) – Either “channel_first” or “channel_last”. “channel_first” corresponds to “OIW”, (default: 'channel_last') “OIHW”, “OIDHW” input data formats for 1-D, 2-D, 3-D convolution respectively, while “channel_last” corresponds to “WIO”, “HWIO”, “DHWIO” respectively.

  • feature_group_count (int) – split input into groups, d_in should be divisible by the number of groups. (default: 1) (Default value = 1)

  • x_dilations (Union[int, Tuple[int], Tuple[int, int], Tuple[int, int, int]]) – The dilation factor for each dimension of input. (Default value = 1) (default: 1)

  • dilations (Union[int, Tuple[int], Tuple[int, int], Tuple[int, int, int]]) – The dilation factor for each dimension of input. (Default value = 1) (default: 1)

  • bias (Optional[Union[Array, NativeArray]]) – Bias array of shape [d_out]. (default: None)

  • out (Optional[Array]) – optional output array, for writing the result to. It must have a shape that the (default: None) inputs broadcast to.

Return type:

Array

Returns:

ret – The result of the transpose or dilated convolution operation.