赞
踩
pytorch, PixelUnshuffle
直接看例子吧,没有画图
>>> import torch >>> a = torch.arange(32).reshape(1, 2, 4, 4) >>> a tensor([[[[ 0, 1, 2, 3], [ 4, 5, 6, 7], [ 8, 9, 10, 11], [12, 13, 14, 15]], [[16, 17, 18, 19], [20, 21, 22, 23], [24, 25, 26, 27], [28, 29, 30, 31]]]]) >>> import torch.nn as nn >>> shuffel = nn.PixelUnshuffle(2) >>> shuffel(a) tensor([[[[ 0, 2], [ 8, 10]], [[ 1, 3], [ 9, 11]], [[ 4, 6], [12, 14]], [[ 5, 7], [13, 15]], [[16, 18], [24, 26]], [[17, 19], [25, 27]], [[20, 22], [28, 30]], [[21, 23], [29, 31]]]])
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。