MCPcopy Create free account
hub / github.com/DPS2022/diffusion-posterior-sampling / reshape_patch

Function reshape_patch

util/img_utils.py:93–96  ·  view source on GitHub ↗
(x, crop_size=128, dim_size=3)

Source from the content-addressed store, hash-verified

91
92
93def reshape_patch(x, crop_size=128, dim_size=3):
94 x = x.transpose(0, 2).squeeze() # [9, 3*(128**2)]
95 x = x.view(dim_size**2, 3, crop_size, crop_size)
96 return x
97
98def reshape_patch_back(x, crop_size=128, dim_size=3):
99 x = x.view(dim_size**2, 3*(crop_size**2)).unsqueeze(dim=-1)

Callers 1

__call__Method · 0.85

Calls 1

transposeMethod · 0.45

Tested by

no test coverage detected