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

Function in1d

monai/transforms/utils_pytorch_numpy_unification.py:87–91  ·  view source on GitHub ↗

`np.in1d` with equivalent implementation for torch.

(x, y)

Source from the content-addressed store, hash-verified

85
86
87def in1d(x, y):
88 """`np.in1d` with equivalent implementation for torch."""
89 if isinstance(x, np.ndarray):
90 return np.isin(x, y)
91 return (x[..., None] == torch.tensor(y, device=x.device)).any(-1).view(-1)
92
93
94def clip(a: NdarrayOrTensor, a_min, a_max) -> NdarrayOrTensor:

Callers 1

__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…