MCPcopy
hub / github.com/dmlc/dgl / _assert_is_sorted

Function _assert_is_sorted

python/dgl/distributed/partition.py:544–552  ·  view source on GitHub ↗
(id_map)

Source from the content-addressed store, hash-verified

542 edge_map = dict(sorted(edge_map.items(), key=lambda x: etypes[x[0]]))
543
544 def _assert_is_sorted(id_map):
545 id_ranges = np.array(list(id_map.values()))
546 ids = []
547 for i in range(num_parts):
548 ids.append(id_ranges[:, i, :])
549 ids = np.array(ids).flatten()
550 assert np.all(
551 ids[:-1] <= ids[1:]
552 ), f"The node/edge map is not sorted: {ids}"
553
554 _assert_is_sorted(node_map)
555 _assert_is_sorted(edge_map)

Callers 1

load_partition_bookFunction · 0.85

Calls 3

appendMethod · 0.80
flattenMethod · 0.80
valuesMethod · 0.45

Tested by

no test coverage detected