Shortcuts

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: v0.15.0
Versions
latest
stable
v0.15.0
v0.14.0
v0.13.0
v0.12.0
Downloads
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.