def pixel_shuffle(input, upscale_factor):
 (batch_size, channels, in_height, in_width) = input.size()
 channels //= (upscale_factor ** 2)
 out_height = (in_height * upscale_factor)
 out_width = (in_width * upscale_factor)
 input_view = input.contiguous().view(batch_size, channels, upscale_factor, upscale_factor, in_height, in_width)
 shuffle_out = input_view.permute(0, 1, 4, 2, 5, 3).contiguous()
 return shuffle_out.view(batch_size, channels, out_height, out_width)

def pixel_shuffle ( input , upscale_factor ) : ( batch_size , channels , in_height , in_width ) = input . size ( ) channels //= ( upscale_factor ** 2 ) out_height = ( in_height * upscale_factor ) out_width = ( in_width * upscale_factor ) input_view = input . contiguous ( ) . view ( batch_size , channels , upscale_factor , upscale_factor , in_height , in_width ) shuffle_out = input_view . permute ( 0 , 1 , 4 , 2 , 5 , 3 ) . contiguous ( ) return shuffle_out . view ( batch_size , channels , out_height , out_width )
rearranges elements in a tensor of shape [* .