ConvPixelShuffle(in_channels, out_channels, upscale_factor: int = 2, kernel_size: int = 3, stride: int = 1, padding: Union[Tuple[int, int], int, str] = 'same', dilation: int = 1, groups: int = 1, bias: bool = True, padding_mode: str = 'zeros', initializer: Callable[[torch.Tensor], torch.Tensor] = None)¶
Two dimensional convolution with ICNR initialization followed by PixelShuffle.
kernel_sizegot a default value of
upscale_factorgot a default value of
4Dinput is allowed (
[batch, channels, height, width]), due to
3Dversions. See [this PyTorch PR](https://github.com/pytorch/pytorch/pull/6340/files) for example of dimension-agnostic implementation.
in_channels (int) – Number of channels in the input image
out_channels (int) – Number of channels produced after PixelShuffle
upscale_factor (int, optional) – Factor to increase spatial resolution by. Default:
padding_mode (string, optional) – Accepted values
groups (int, optional) – Number of blocked connections from input channels to output channels. Default: 1
bias (bool, optional) – If
True, adds a learnable bias to the output. Default:
initializer (typing.Callable[[torch.Tensor,], torch.Tensor], optional) – Initializer for ICNR initialization, can be a function from
torch.nn.init. Gets and returns tensor after initialization. Default:
Defines the computation performed at every call.
Should be overridden by all subclasses.
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
ICNR initializer for checkerboard artifact free sub pixel convolution.
Originally presented in Checkerboard artifact free sub-pixel convolution: A note on sub-pixel convolution, resize convolution and convolution resize Initializes convolutional layer prior to
torch.nn.PixelShuffle. Weights are initialized according to
initializerpassed to to
Initialize weights after layer was built.