Shortcuts

Note

You are reading the documentation for MMEditing 0.x, which will soon be deprecated by the end of 2022. We recommend you upgrade to MMEditing 1.0 to enjoy fruitful new features and better performance brought by OpenMMLab 2.0. Check out the changelog, code and documentation of MMEditing 1.0 for more details.

Source code for mmedit.models.common.downsample

# Copyright (c) OpenMMLab. All rights reserved.
[docs]def pixel_unshuffle(x, scale): """Down-sample by pixel unshuffle. Args: x (Tensor): Input tensor. scale (int): Scale factor. Returns: Tensor: Output tensor. """ b, c, h, w = x.shape if h % scale != 0 or w % scale != 0: raise AssertionError( f'Invalid scale ({scale}) of pixel unshuffle for tensor ' f'with shape: {x.shape}') h = int(h / scale) w = int(w / scale) x = x.view(b, c, h, scale, w, scale) x = x.permute(0, 1, 3, 5, 2, 4) return x.reshape(b, -1, h, w)
Read the Docs v: latest
Versions
latest
stable
1.x
v0.16.0
v0.15.2
v0.15.1
v0.15.0
v0.14.0
v0.13.0
v0.12.0
dev-1.x
Downloads
pdf
html
epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.