Spec-Zone.ru › PyTorch 2

PixelUnshuffle

class torch.nn.PixelUnshuffle(downscale_factor) [source]

Отменяет операцию PixelShuffle, переупорядочивая элементы в тензоре с формой (∗,C,H×r,W×r)(*, C, H \times r, W \times r) в тензор с формой (∗,C×r2,H,W)(*, C \times r^2, H, W), где r — коэффициент уменьшения.

См. статью: Real-Time Single Image and Video Super-Resolution Using an Efficient Sub-Pixel Convolutional Neural Network Ши и соавт. (2016) для получения более подробной информации.

Параметры

downscale_factor (int) – коэффициент уменьшения пространственного разрешения

Форма:
  • Вход: (∗,Cin,Hin,Win)(*, C_{in}, H_{in}, W_{in}), где * обозначает ноль или более размерностей пакетной обработки
  • Выход: (∗,Cout,Hout,Wout)(*, C_{out}, H_{out}, W_{out}), где
Cout=Cin×downscale_factor2C_{out} = C_{in} \times \text{downscale\_factor}^2
Hout=Hin÷downscale_factorH_{out} = H_{in} \div \text{downscale\_factor}
Wout=Win÷downscale_factorW_{out} = W_{in} \div \text{downscale\_factor}

Примеры:

>>> pixel_unshuffle = nn.PixelUnshuffle(3)
>>> input = torch.randn(1, 1, 12, 12)
>>> output = pixel_unshuffle(input)
>>> print(output.size())
torch.Size([1, 9, 4, 4])

© 2024, PyTorch Contributors
PyTorch has a BSD-style license, as found in the LICENSE file.
https://pytorch.org/docs/2.1/generated/torch.nn.PixelUnshuffle.html

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API