MCPcopy Create free account
hub / github.com/SwayStar123/SpeedrunDiT / array2grid

Function array2grid

train.py:47–51  ·  view source on GitHub ↗
(x)

Source from the content-addressed store, hash-verified

45
46
47def array2grid(x):
48 nrow = round(math.sqrt(x.size(0)))
49 x = make_grid(x.clamp(0, 1), nrow=nrow, value_range=(0, 1))
50 x = x.mul(255).add_(0.5).clamp_(0, 255).permute(1, 2, 0).to('cpu', torch.uint8).numpy()
51 return x
52
53
54@torch.no_grad()

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected