MCPcopy Create free account
hub / github.com/apple/ml-pointersect / get_img_max_val

Function get_img_max_val

plib/utils.py:2712–2721  ·  view source on GitHub ↗
(img: T.Union[np.ndarray, torch.Tensor])

Source from the content-addressed store, hash-verified

2710
2711
2712def get_img_max_val(img: T.Union[np.ndarray, torch.Tensor]):
2713 if isinstance(img, torch.Tensor):
2714 img = img.detach().cpu().numpy()
2715
2716 dtype = img.dtype
2717 if dtype in {np.float32, np.float64, float}:
2718 max_val = 1.
2719 else:
2720 max_val = np.iinfo(dtype).max
2721 return max_val
2722
2723
2724def sample_patch(

Callers

nothing calls this directly

Calls 1

detachMethod · 0.45

Tested by

no test coverage detected