MCPcopy Index your code
hub / github.com/dmlc/dgl / set_diff

Function set_diff

python/dgl/utils/internal.py:320–341  ·  view source on GitHub ↗

Find the set difference of two index arrays. Return the unique values in ar1 that are not in ar2. Parameters ---------- ar1: utils.Index Input index array. ar2: utils.Index Input comparison index array. Returns ------- setdiff: Array of valu

(ar1, ar2)

Source from the content-addressed store, hash-verified

318
319
320def set_diff(ar1, ar2):
321 """Find the set difference of two index arrays.
322 Return the unique values in ar1 that are not in ar2.
323
324 Parameters
325 ----------
326 ar1: utils.Index
327 Input index array.
328
329 ar2: utils.Index
330 Input comparison index array.
331
332 Returns
333 -------
334 setdiff:
335 Array of values in ar1 that are not in ar2.
336 """
337 ar1_np = ar1.tonumpy()
338 ar2_np = ar2.tonumpy()
339 setdiff = np.setdiff1d(ar1_np, ar2_np)
340 setdiff = toindex(setdiff)
341 return setdiff
342
343
344class LazyDict(Mapping):

Callers

nothing calls this directly

Calls 2

toindexFunction · 0.85
tonumpyMethod · 0.80

Tested by

no test coverage detected