MCPcopy Create free account
hub / github.com/bbaaii/DreamDiffusion / patchify

Function patchify

code/sc_mbm/utils.py:103–113  ·  view source on GitHub ↗

imgs: (N, 1, num_voxels) x: (N, L, patch_size)

(imgs, patch_size)

Source from the content-addressed store, hash-verified

101 print(f'Model loaded with {checkpoint_path}')
102
103def patchify(imgs, patch_size):
104 """
105 imgs: (N, 1, num_voxels)
106 x: (N, L, patch_size)
107 """
108 p = patch_size
109 assert imgs.ndim == 3 and imgs.shape[2] % p == 0
110
111 h = imgs.shape[2] // p
112 x = imgs.reshape(shape=(imgs.shape[0], h, p))
113 return x
114
115def unpatchify(x, patch_size):
116 """

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected