class_docstr: General n-dimensional transposed convolution (aka. deconvolution).
class_docstr_tok: ["General","n-dimensional","transposed","convolution","(","aka",".","deconvolution",")","."]
docstr: Initializes the module.
  
  Args:
    num_spatial_dims: The number of spatial dimensions of the input.
    output_channels: Number of output channels.
    kernel_shape: The shape of the kernel. Either an integer or a sequence of
      length ``num_spatial_dims``.
    stride: Optional stride for the kernel. Either an integer or a sequence of
      length ``num_spatial_dims``. Defaults to 1.
    output_shape: Output shape of the spatial dimensions of a transpose
      convolution. Can be either an integer or an iterable of integers. If a
      `None` value is given, a default shape is automatically calculated.
    padding: Optional padding algorithm. Either "VALID" or "SAME".
      Defaults to "SAME". See:
      https://www.tensorflow.org/xla/operation_semantics#conv_convolution.
    with_bias: Whether to add a bias. By default, true.
    w_init: Optional weight initialization. By default, truncated normal.
    b_init: Optional bias initialization. By default, zeros.
    data_format: The data format of the input. Can be either
      ``channels_first``, ``channels_last``, ``N...C`` or ``NC...``. By
      default, ``channels_last``.
    mask: Optional mask of the weights.
    name: The name of the module.
docstr_tok: ["Initializes","the","module",".","Args",":","num_spatial_dims",":","The","number","of","spatial","dimensions","of","the","input",".","output_channels",":","Number","of","output","channels",".","kernel_shape",":","The","shape","of","the","kernel",".","Either","an","integer","or","a","sequence","of","length","``","num_spatial_dims","``",".","stride",":","Optional","stride","for","the","kernel",".","Either","an","integer","or","a","sequence","of","length","``","num_spatial_dims","``",".","Defaults","to","1.","output_shape",":","Output","shape","of","the","spatial","dimensions","of","a","transpose","convolution",".","Can","be","either","an","integer","or","an","iterable","of","integers",".","If","a","`","None","`","value","is","given",",","a","default","shape","is","automatically","calculated",".","padding",":","Optional","padding","algorithm",".","Either","``","VALID","''","or","``","SAME","''",".","Defaults","to","``","SAME","''",".","See",":","https",":","\/\/www.tensorflow.org\/xla\/operation_semantics","#","conv_convolution",".","with_bias",":","Whether","to","add","a","bias",".","By","default",",","true",".","w_init",":","Optional","weight","initialization",".","By","default",",","truncated","normal",".","b_init",":","Optional","bias","initialization",".","By","default",",","zeros",".","data_format",":","The","data","format","of","the","input",".","Can","be","either","``","channels_first","``",",","``","channels_last","``",",","``","N","...","C","``","or","``","NC","...","``",".","By","default",",","``","channels_last","``",".","mask",":","Optional","mask","of","the","weights",".","name",":","The","name","of","the","module","."]
code: def __init__(
      self,
      num_spatial_dims: int,
      output_channels: int,
      kernel_shape: Union[int, Sequence[int]],
      stride: Union[int, Sequence[int]] = 1,
      output_shape: Optional[Union[int, Sequence[int]]] = None,
      padding: Union[str, Sequence[tuple[int, int]]] = "SAME",
      with_bias: bool = True,
      w_init: Optional[hk.initializers.Initializer] = None,
      b_init: Optional[hk.initializers.Initializer] = None,
      data_format: str = "channels_last",
      mask: Optional[jax.Array] = None,
      name: Optional[str] = None,
  ):
      """Initializes the module.
  
      Args:
        num_spatial_dims: The number of spatial dimensions of the input.
        output_channels: Number of output channels.
        kernel_shape: The shape of the kernel. Either an integer or a sequence of
          length ``num_spatial_dims``.
        stride: Optional stride for the kernel. Either an integer or a sequence of
          length ``num_spatial_dims``. Defaults to 1.
        output_shape: Output shape of the spatial dimensions of a transpose
          convolution. Can be either an integer or an iterable of integers. If a
          `None` value is given, a default shape is automatically calculated.
        padding: Optional padding algorithm. Either "VALID" or "SAME".
          Defaults to "SAME". See:
          https://www.tensorflow.org/xla/operation_semantics#conv_convolution.
        with_bias: Whether to add a bias. By default, true.
        w_init: Optional weight initialization. By default, truncated normal.
        b_init: Optional bias initialization. By default, zeros.
        data_format: The data format of the input. Can be either
          ``channels_first``, ``channels_last``, ``N...C`` or ``NC...``. By
          default, ``channels_last``.
        mask: Optional mask of the weights.
        name: The name of the module.
      """
      super().__init__(name=name)
  
      if num_spatial_dims <= 0:
          raise ValueError(
              "We only support convolution operations for `num_spatial_dims` "
              f"greater than 0, received num_spatial_dims={num_spatial_dims}."
          )
  
      self.num_spatial_dims = num_spatial_dims
      self.output_channels = output_channels
      self.kernel_shape = utils.replicate(
          kernel_shape, num_spatial_dims, "kernel_shape"
      )
      self.output_shape = output_shape
      if self.output_shape is not None:
          self.output_shape = utils.replicate(
              output_shape, num_spatial_dims, "output_shape"
          )
          if not isinstance(padding, str):
              raise ValueError(
                  "When specifying `output_shape`, ensure that paddding "
                  "is 'VALID' or 'SAME'."
              )
      self.with_bias = with_bias
      self.stride = utils.replicate(stride, num_spatial_dims, "strides")
      self.w_init = w_init
      self.b_init = b_init or jnp.zeros
      self.mask = mask
      # TODO(tomhennigan) Make use of hk.pad.create_from_tuple here?
      self.padding = padding
      self.data_format = data_format
      self.channel_index = hk.get_channel_index(data_format)
      self.dimension_numbers = to_dimension_numbers(
          num_spatial_dims,
          channels_last=(self.channel_index == -1),
          transpose=True,
      )
  
imports: from collections.abc import Sequence
  from typing import Optional, Union
  from haiku._src import base
  from haiku._src import initializers
  from haiku._src import module
  from haiku._src import pad
  from haiku._src import utils
  import jax
  from jax import lax
  import jax.numpy
  import numpy
label_desc: Use image node_id 1 to create a new ConvNDTranspose object from inherited base classes: hk with example: obj = ConvNDTranspose(num_spatial_dims, output_channels, kernel_shape, stride, output_shape, padding, with_bias, w_init, b_init, data_format, mask, name)