MCPcopy Create free account
hub / github.com/TencentARC/BrushNet / pt_to_numpy

Method pt_to_numpy

src/diffusers/image_processor.py:125–130  ·  view source on GitHub ↗

Convert a PyTorch tensor to a NumPy image.

(images: torch.FloatTensor)

Source from the content-addressed store, hash-verified

123
124 @staticmethod
125 def pt_to_numpy(images: torch.FloatTensor) -> np.ndarray:
126 """
127 Convert a PyTorch tensor to a NumPy image.
128 """
129 images = images.cpu().permute(0, 2, 3, 1).float().numpy()
130 return images
131
132 @staticmethod
133 def normalize(images: Union[np.ndarray, torch.Tensor]) -> Union[np.ndarray, torch.Tensor]:

Callers 5

resizeMethod · 0.95
postprocessMethod · 0.95
postprocessMethod · 0.80
_convert_pt_to_pilFunction · 0.80
convert_pt_to_typeMethod · 0.80

Calls

no outgoing calls

Tested by 1

convert_pt_to_typeMethod · 0.64