qbm4eo.decoder module


This file is a part of qbm4eo.rst project.

https://github.com/FeralQubits/qbm4eo


It has been modified as a part of the EuroHPC PL project funded at the Smart Growth Operational Programme 2014-2020, Measure 4.2 under the grant agreement no. POIR.04.02.00-00-D014/20-00.


class qbm4eo.decoder.LBAEDecoder(input_size: Sequence[int], output_size: Sequence[int], latent_space_size: int, num_layers: int, *args: Dict[str, Any], negative_slope: float = 0.02, bias: bool = False, **kwargs: Dict[str, Any])[source]

Bases: Module

The decoder part of the LBAE model.

A default constructor for the LBAEDecoder class.

Parameters:
  • input_size – The size of the input tensor. This should be a tuple of the form (channels, height, width). The height and width should be divisible by 2**num_layers.

  • output_size – The size of the output tensor.

  • latent_space_size – The size of the latent space. This is the size of the input to the linear layer.

  • num_layers – The number of layers in the decoder. This is the number of ResBlockDeConv blocks.

  • negative_slope – The negative slope of the LeakyReLU activation function.

  • bias – Whether to use a bias term in the convolutional layer.

  • args – Additional arguments to pass to the super class.

  • kwargs – Additional keyword arguments to pass to the super class.

forward(x: Tensor) Tensor[source]

The forward pass of the LBAEDecoder class.

Parameters:

x – The input tensor.

Returns:

The output tensor of the decoder.

class qbm4eo.decoder.ResBlockDeConv(channels: int, *args: Dict[str, Any], in_channels: int | None = None, negative_slope: float = 0.02, bias: bool = False, **kwargs: Dict[str, Any])[source]

Bases: Module

A residual block for the decoder part of the LBAE model.

A default constructor for the ResBlockDeConv class.

Parameters:
  • channels – The number of channels in the input and output.

  • in_channels – The number of channels in the input. If None, defaults to the number of channels in the output. Defaults to None.

  • negative_slope – The negative slope of the LeakyReLU activation function.

  • bias – Whether to use a bias term in the convolutional layer.

  • args – Additional arguments to pass to the super class.

  • kwargs – Additional keyword arguments to pass to the super class.

forward(x: Tensor) Tensor[source]

The forward pass of the ResBlockDeConv class.

Parameters:

x – The input tensor.

Returns:

The output tensor.

class qbm4eo.decoder.ResBlockDeConvPart(channels: int, *args: Dict[str, Any], negative_slope: float = 0.02, bias: bool = False, **kwargs: Dict[str, Any])[source]

Bases: Module

A single part of the ResBlockDeConv class.

A default constructor for the ResBlockDeConvPart class.

Parameters:
  • channels – The number of channels in the input and output.

  • negative_slope – The negative slope of the LeakyReLU activation function.

  • bias – Whether to use a bias term in the convolutional layer.

  • args – Additional arguments to pass to the super class.

  • kwargs – Additional keyword arguments to pass to the super class.

forward(x: Tensor) Tensor[source]

The forward pass of the ResBlockDeConvPart class.

Parameters:

x – The input tensor.

Returns:

The output tensor.