dgl.graphbolt.isinΒΆ
-
dgl.graphbolt.
isin
(elements, test_elements)[source]ΒΆ Tests if each element of elements is in test_elements. Returns a boolean tensor of the same shape as elements that is True for elements in test_elements and False otherwise.
- Parameters
elements (torch.Tensor) β A 1D tensor represents the input elements.
test_elements (torch.Tensor) β A 1D tensor represents the values to test against for each input.
Examples
>>> isin(torch.tensor([1, 2, 3, 4]), torch.tensor([2, 3])) tensor([[False, True, True, False]])