class_docstr: Spatial depth-wise 2D convolution module, including bias.
  
  This acts as a light wrapper around the TensorFlow ops
  `tf.nn.depthwise_conv2d`, abstracting away variable creation and sharing.
docstr: Constructs a `DepthwiseConv2D` module.
  
  Args:
    kernel_shape: Sequence of kernel sizes (of length num_spatial_dims), or an
      integer. `kernel_shape` will be expanded to define a kernel size in
      all dimensions.
    channel_multiplier: Number of channels to expand convolution to. Must be
        an integer greater than 0. When `channel_multiplier` is 1, applies
        a different filter to each input channel producing one output channel
        per input channel. Numbers larger than 1 cause multiple different
        filters to be applied to each input channel, with their outputs being
        concatenated together, producing `channel_multiplier` *
        `input_channels` output channels.
    stride: Sequence of strides (of length num_spatial_dims), or an integer.
      `stride` will be expanded to define stride in all dimensions.
    rate: Sequence of dilation rates (of length num_spatial_dims), or integer
      that is used to define dilation rate in all dimensions. 1 corresponds
      to standard ND convolution, `rate > 1` corresponds to dilated
      convolution.
    padding: Padding to apply to the input. This can either "SAME", "VALID".
    with_bias: Whether to include bias parameters. Default `True`.
    w_init: Optional initializer for the weights. By default the weights are
      initialized truncated random normal values with a standard deviation of
      `1 / sqrt(input_feature_size)`, which is commonly used when the inputs
      are zero centered (see https://arxiv.org/abs/1502.03167v3).
    b_init: Optional initializer for the bias. By default the bias is
      initialized to zero.
    data_format: The data format of the input.
    name: Name of the module.
code: def __init__(
      self,
      kernel_shape: Union[int, Sequence[int]],
      channel_multiplier: int = 1,
      stride: Union[int, Sequence[int]] = 1,
      rate: Union[int, Sequence[int]] = 1,
      padding: str = "SAME",
      with_bias: bool = True,
      w_init: Optional[initializers.Initializer] = None,
      b_init: Optional[initializers.Initializer] = None,
      data_format: str = "NHWC",
      name: Optional[str] = None,
  ):
      """Constructs a `DepthwiseConv2D` module.
  
      Args:
        kernel_shape: Sequence of kernel sizes (of length num_spatial_dims), or an
          integer. `kernel_shape` will be expanded to define a kernel size in
          all dimensions.
        channel_multiplier: Number of channels to expand convolution to. Must be
            an integer greater than 0. When `channel_multiplier` is 1, applies
            a different filter to each input channel producing one output channel
            per input channel. Numbers larger than 1 cause multiple different
            filters to be applied to each input channel, with their outputs being
            concatenated together, producing `channel_multiplier` *
            `input_channels` output channels.
        stride: Sequence of strides (of length num_spatial_dims), or an integer.
          `stride` will be expanded to define stride in all dimensions.
        rate: Sequence of dilation rates (of length num_spatial_dims), or integer
          that is used to define dilation rate in all dimensions. 1 corresponds
          to standard ND convolution, `rate > 1` corresponds to dilated
          convolution.
        padding: Padding to apply to the input. This can either "SAME", "VALID".
        with_bias: Whether to include bias parameters. Default `True`.
        w_init: Optional initializer for the weights. By default the weights are
          initialized truncated random normal values with a standard deviation of
          `1 / sqrt(input_feature_size)`, which is commonly used when the inputs
          are zero centered (see https://arxiv.org/abs/1502.03167v3).
        b_init: Optional initializer for the bias. By default the bias is
          initialized to zero.
        data_format: The data format of the input.
        name: Name of the module.
      """
      super().__init__(name=name)
  
      self.channel_multiplier = channel_multiplier
      self.kernel_shape = kernel_shape
      self.data_format = data_format
      self._channel_index = utils.get_channel_index(data_format)
      stride = utils.replicate(stride, 2, "stride")
      if self._channel_index == 1:
          self.stride = (1, 1) + stride
      else:
          self.stride = (1,) + stride + (1,)
      self.rate = utils.replicate(rate, 2, "rate")
      self.padding = padding
  
      self.with_bias = with_bias
      self.w_init = w_init
      if with_bias:
          self.b_init = (
              b_init if b_init is not None else initializers.Zeros()
          )
      elif b_init is not None:
          raise ValueError(
              "When not using a bias the b_init must be None."
          )
  
file_path: sonnet/sonnet/src/depthwise_conv.py
imports: from typing import Optional, Sequence, Union
  import numpy
  from sonnet.src import base
  from sonnet.src import initializers
  from sonnet.src import once
  from sonnet.src import utils
  import tensorflow
label_desc: Use image node_id 1 to create a new DepthwiseConv2D object from inherited base classes: base with example: obj = DepthwiseConv2D(kernel_shape, channel_multiplier, stride, rate, padding, with_bias, w_init, b_init, data_format, name)