MCPcopy Create free account
hub / github.com/Project-MONAI/MONAI / unique

Function unique

monai/transforms/utils_pytorch_numpy_unification.py:441–447  ·  view source on GitHub ↗

`torch.unique` with equivalent implementation for numpy. Args: x: array/tensor.

(x: NdarrayTensor, **kwargs)

Source from the content-addressed store, hash-verified

439
440
441def unique(x: NdarrayTensor, **kwargs) -> NdarrayTensor:
442 """`torch.unique` with equivalent implementation for numpy.
443
444 Args:
445 x: array/tensor.
446 """
447 return np.unique(x, **kwargs) if isinstance(x, (np.ndarray, list)) else torch.unique(x, **kwargs) # type: ignore
448
449
450def linalg_inv(x: NdarrayTensor) -> NdarrayTensor:

Callers 4

__call__Method · 0.90
remove_small_objectsFunction · 0.90
get_unique_labelsFunction · 0.90
__call__Method · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…