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

Method to_np

diffusers/tests/others/test_image_processor.py:48–53  ·  view source on GitHub ↗
(self, image)

Source from the content-addressed store, hash-verified

46 return sample
47
48 def to_np(self, image):
49 if isinstance(image[0], PIL.Image.Image):
50 return np.stack([np.array(i) for i in image], axis=0)
51 elif isinstance(image, torch.Tensor):
52 return image.cpu().numpy().transpose(0, 2, 3, 1)
53 return image
54
55 def test_vae_image_processor_pt(self):
56 image_processor = VaeImageProcessor(do_resize=False, do_normalize=True)

Calls 1

transposeMethod · 0.80

Tested by

no test coverage detected