MCPcopy Create free account
hub / github.com/AlayaLab/Hive / numpy_to_pt

Method numpy_to_pt

models/flowsep/diffusers/image_processor.py:72–80  ·  view source on GitHub ↗

Convert a numpy image to a pytorch tensor

(images)

Source from the content-addressed store, hash-verified

70
71 @staticmethod
72 def numpy_to_pt(images):
73 """
74 Convert a numpy image to a pytorch tensor
75 """
76 if images.ndim == 3:
77 images = images[..., None]
78
79 images = torch.from_numpy(images.transpose(0, 3, 1, 2))
80 return images
81
82 @staticmethod
83 def pt_to_numpy(images):

Callers 1

preprocessMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected