pytagi.nn.convtranspose2d#

Classes#

ConvTranspose2d

Applies a 2D transposed convolution operation (also known as deconvolution).

Module Contents#

class pytagi.nn.convtranspose2d.ConvTranspose2d(in_channels: int, out_channels: int, kernel_size: int, bias: bool = True, stride: int = 1, padding: int = 0, padding_type: int = 1, in_width: int = 0, in_height: int = 0, gain_weight: float = 1.0, gain_bias: float = 1.0, init_method: str = 'He')[source]#

Bases: pytagi.nn.base_layer.BaseLayer

Applies a 2D transposed convolution operation (also known as deconvolution).

This layer performs a transposed convolution, which is used in tasks like image generation or segmentation to upsample feature maps. It reverses the convolution operation, increasing the spatial dimensions of the input.

Parameters:
  • in_channels (int) – Number of input channels.

  • out_channels (int) – Number of output channels.

  • kernel_size (int) – Size of the convolutional kernel.

  • bias (bool) – Whether to include a learnable bias term. Defaults to True.

  • stride (int) – The step size of the kernel. Defaults to 1.

  • padding (int) – Amount of zero-padding added to the input. Defaults to 0.

  • padding_type (int) – Type of padding. Defaults to 1 (likely ‘zeros’ or similar).

  • in_width (int) – Input width. If 0, it might be inferred or set by the backend. Defaults to 0.

  • in_height (int) – Input height. If 0, it might be inferred or set by the backend. Defaults to 0.

  • gain_weight (float) – Initial value for the gain (scale) parameter of weights. Defaults to 1.0.

  • gain_bias (float) – Initial value for the gain (scale) parameter of biases. Defaults to 1.0.

  • init_method (str) – Method used for initializing weights. Defaults to “He”.

Initializes the ConvTranspose2d layer.

get_layer_info() str[source]#

Retrieves detailed information about the ConvTranspose2d layer.

Returns:

A string containing the layer’s information.

Return type:

str

get_layer_name() str[source]#

Retrieves the name of the ConvTranspose2d layer.

Returns:

The name of the layer.

Return type:

str

init_weight_bias()[source]#

Initializes the learnable weight and bias parameters of the transposed convolutional layer.