depthwise_conv2d

dragon.nn.depthwise_conv2d(
  inputs,
  num_output=None,
  kernel_shape=3,
  strides=1,
  pads=0,
  dilations=1,
  padding='VALID',
  data_format='NCHW',
  **kwargs
)[source]

Apply the 2d depthwise convolution. [Chollet, 2016].

The spatial output dimension is computed as:

\[\begin{cases} \text{DK}_{size} = dilation * (\text{K}_{size} - 1) + 1 \\ \text{Dim}_{out} = (\text{Dim}_{in} + 2 * pad - \text{DK}_{size}) / stride + 1 \end{cases} \]

Set padding to VALID will use the value of pads.

Parameters:
  • inputs (Sequence[dragon.Tensor]) – The tensor x, weight and bias.
  • num_output (int, optional) – The optional number of output channels.
  • kernel_shape (Sequence[int], optional, default=3) – The size(s) of convolution kernel.
  • strides (Sequence[int], optional, default=1) – The stride(s) of sliding window.
  • pads (Sequence[int], optional, default=0) – The zero padding size(s) of convolution.
  • dilations (Sequence[int], optional, default=0) – The rate(s) of dilated kernel.
  • padding ({'VALID', 'SAME', 'SAME_UPPER', 'SAME_LOWER'}, optional) – The padding algorithm.
  • data_format ({'NCHW', 'NHWC'}, optional) – The optional data format.
Returns:

dragon.Tensor – The output tensor.