Shortcuts

mmagic.models.archs.upsample

Module Contents

Classes

PixelShufflePack

Pixel Shuffle upsample layer.

class mmagic.models.archs.upsample.PixelShufflePack(in_channels: int, out_channels: int, scale_factor: int, upsample_kernel: int)[source]

Bases: torch.nn.Module

Pixel Shuffle upsample layer.

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

  • out_channels (int) – Number of output channels.

  • scale_factor (int) – Upsample ratio.

  • upsample_kernel (int) – Kernel size of Conv layer to expand channels.

Returns

Upsampled feature map.

init_weights() None[source]

Initialize weights for PixelShufflePack.

forward(x: torch.Tensor) torch.Tensor[source]

Forward function for PixelShufflePack.

Parameters

x (Tensor) – Input tensor with shape (n, c, h, w).

Returns

Forward results.

Return type

Tensor