{"id":17317383,"url":"https://github.com/fangwei123456/pixelunshuffle-pytorch","last_synced_at":"2025-04-14T15:21:22.655Z","repository":{"id":113881860,"uuid":"204653688","full_name":"fangwei123456/PixelUnshuffle-pytorch","owner":"fangwei123456","description":"PixelUnshuffle, inverse operation of PixelShuffle","archived":false,"fork":false,"pushed_at":"2021-07-30T07:07:57.000Z","size":11,"stargazers_count":21,"open_issues_count":2,"forks_count":7,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-28T04:11:32.245Z","etag":null,"topics":["computer-vision","machine-learning","pytorch","super-resolution"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fangwei123456.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2019-08-27T08:13:22.000Z","updated_at":"2023-02-11T07:41:21.000Z","dependencies_parsed_at":null,"dependency_job_id":"22e5b77d-c309-4ea1-aded-d970a747c1c8","html_url":"https://github.com/fangwei123456/PixelUnshuffle-pytorch","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fangwei123456%2FPixelUnshuffle-pytorch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fangwei123456%2FPixelUnshuffle-pytorch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fangwei123456%2FPixelUnshuffle-pytorch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fangwei123456%2FPixelUnshuffle-pytorch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fangwei123456","download_url":"https://codeload.github.com/fangwei123456/PixelUnshuffle-pytorch/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248904623,"owners_count":21180836,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["computer-vision","machine-learning","pytorch","super-resolution"],"created_at":"2024-10-15T13:16:27.217Z","updated_at":"2025-04-14T15:21:22.614Z","avatar_url":"https://github.com/fangwei123456.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PixelUnshuffle-pytorch\n\nPyTorch has provided an official implement: https://pytorch.org/docs/stable/generated/torch.nn.PixelUnshuffle.html.\n\n----------------------------------------------------\nPixelUnshuffle, inverse operation of PixelShuffle.\n\n\n\n| in pytorch                                           | inverse in PixelUnshuffle                  |\n| ---------------------------------------------------- | ------------------------------------------ |\n| `nn.PixelShuffle(upscale_factor)`                    | `PixelUnshuffle(downscale_factor)`         |\n| `nn.functional.pixel_shuffle(input, upscale_factor)` | `pixel_unshuffle(input, downscale_factor)` |\n\n\n\n**Installation:**\n\n```\n1.Clone this repo.\n2.Copy \"PixelUnshuffle\" folder in your project.\n```\n\n**Example:**\n\n```python\nimport PixelUnshuffle\nimport torch\nimport torch.nn as nn\nimport torch.nn.functional as F\nx = torch.range(start=0, end=31).reshape([1, 8, 2, 2])\nprint('x:')\nprint(x.shape)\nprint(x)\ny = F.pixel_shuffle(x, 2)\nprint('y:')\nprint(y.shape)\nprint(y)\nx_ = PixelUnshuffle.pixel_unshuffle(y, 2)\nprint('x_:')\nprint(x_.shape)\nprint(x_)\n```\n\noutput:\n\n```python\nx:\ntorch.Size([1, 8, 2, 2])\ntensor([[[[ 0.,  1.],\n          [ 2.,  3.]],\n\n         [[ 4.,  5.],\n          [ 6.,  7.]],\n\n         [[ 8.,  9.],\n          [10., 11.]],\n\n         [[12., 13.],\n          [14., 15.]],\n\n         [[16., 17.],\n          [18., 19.]],\n\n         [[20., 21.],\n          [22., 23.]],\n\n         [[24., 25.],\n          [26., 27.]],\n\n         [[28., 29.],\n          [30., 31.]]]])\ny:\ntorch.Size([1, 2, 4, 4])\ntensor([[[[ 0.,  4.,  1.,  5.],\n          [ 8., 12.,  9., 13.],\n          [ 2.,  6.,  3.,  7.],\n          [10., 14., 11., 15.]],\n\n         [[16., 20., 17., 21.],\n          [24., 28., 25., 29.],\n          [18., 22., 19., 23.],\n          [26., 30., 27., 31.]]]])\nx_:\ntorch.Size([1, 8, 2, 2])\ntensor([[[[ 0.,  1.],\n          [ 2.,  3.]],\n\n         [[ 4.,  5.],\n          [ 6.,  7.]],\n\n         [[ 8.,  9.],\n          [10., 11.]],\n\n         [[12., 13.],\n          [14., 15.]],\n\n         [[16., 17.],\n          [18., 19.]],\n\n         [[20., 21.],\n          [22., 23.]],\n\n         [[24., 25.],\n          [26., 27.]],\n\n         [[28., 29.],\n          [30., 31.]]]])\n\n```\n\nA neat way can be found here:\n\n[pytorch/pytorch#2456](https://github.com/pytorch/pytorch/issues/2456)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffangwei123456%2Fpixelunshuffle-pytorch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffangwei123456%2Fpixelunshuffle-pytorch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffangwei123456%2Fpixelunshuffle-pytorch/lists"}