MCPcopy Create free account
hub / github.com/YesianRohn/TextSSR / numpy2tensor

Function numpy2tensor

diffusers/examples/community/fresco_v2v.py:146–150  ·  view source on GitHub ↗
(img)

Source from the content-addressed store, hash-verified

144
145
146def numpy2tensor(img):
147 x0 = torch.from_numpy(img.copy()).float().cuda() / 255.0 * 2.0 - 1.0
148 x0 = torch.stack([x0], dim=0)
149 # einops.rearrange(x0, 'b h w c -> b c h w').clone()
150 return x0.permute(0, 3, 1, 2)
151
152
153def calc_mean_std(feat, eps=1e-5, chunk=1):

Callers 1

Calls 1

cudaMethod · 0.45

Tested by

no test coverage detected