mindscience.common.unpatchify
- mindscience.common.unpatchify(labels, img_size=(192, 384), patch_size=16, nchw=False)[source]
Convert a sequence of flattened patches back into an image-like tensor.
- Parameters
labels (Tensor) – A tensor containing flattened patch representations. The shape of labels is expected to be \((N, num_patches, patch_size * patch_size * C)\), where C denotes the number of output channels.
img_size (tuple(int), optional) – Input image size. Default
(192, 384).patch_size (int, optional) – The patch size of image. Default
16.nchw (bool, optional) – If
True, the unpatchify shape contains \((N, C, H, W)\); ifFalse, the unpatchify shape contains \((N, H, W, C)\). Default:False.
- Returns
Tensor, with shape of \((N, H, W, C)\) if nchw is
Falseor \((N, C, H, W)\) if nchw isTrue.