MCPcopy Create free account
hub / github.com/JaydenLyh/Reward-Forcing / pytorch2numpy

Function pytorch2numpy

demo_utils/utils.py:411–418  ·  view source on GitHub ↗
(imgs)

Source from the content-addressed store, hash-verified

409
410@torch.inference_mode()
411def pytorch2numpy(imgs):
412 results = []
413 for x in imgs:
414 y = x.movedim(0, -1)
415 y = y * 127.5 + 127.5
416 y = y.detach().float().cpu().numpy().clip(0, 255).astype(np.uint8)
417 results.append(y)
418 return results
419
420
421@torch.inference_mode()

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected