argmax for N-D array → returns coordinate vector (z,y,x) or (y,x).
(x)
| 22 | |
| 23 | |
| 24 | def _argmax_nd(x) -> np.ndarray: |
| 25 | """argmax for N-D array → returns coordinate vector (z,y,x) or (y,x).""" |
| 26 | if isinstance(x, torch.Tensor): |
| 27 | x = x.cpu().numpy() |
| 28 | return np.asarray(np.unravel_index(np.argmax(x), x.shape)) |
| 29 | |
| 30 | |
| 31 | # Test cases for 2D array inputs with different data types |
no outgoing calls
no test coverage detected
searching dependent graphs…