Function
get_img_max_val
(img: T.Union[np.ndarray, torch.Tensor])
Source from the content-addressed store, hash-verified
| 2710 | |
| 2711 | |
| 2712 | def 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 | |
| 2724 | def sample_patch( |
Callers
nothing calls this directly
Tested by
no test coverage detected