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

Function read_orig_ids

tools/verification_utils.py:266–293  ·  view source on GitHub ↗

Read original id files for the partitioned graph objects Parameters: ----------- out_dir : string specifying the directory where the files are located fname : string file name to read from num_parts : integer no. of partitions Returns: --------

(out_dir, fname, num_parts)

Source from the content-addressed store, hash-verified

264
265
266def read_orig_ids(out_dir, fname, num_parts):
267 """Read original id files for the partitioned graph objects
268
269 Parameters:
270 -----------
271 out_dir : string
272 specifying the directory where the files are located
273 fname : string
274 file name to read from
275 num_parts : integer
276 no. of partitions
277
278 Returns:
279 --------
280 dictionary :
281 where keys are node/edge types and values are original node
282 or edge ids from the original graph
283 """
284 orig_ids = {}
285 for i in range(num_parts):
286 ids_path = os.path.join(out_dir, f"part{i}", fname)
287 part_ids = load_tensors(ids_path)
288 for type, data in part_ids.items():
289 if type not in orig_ids:
290 orig_ids[type] = data.numpy()
291 else:
292 orig_ids[type] = np.concatenate((orig_ids[type], data))
293 return orig_ids

Callers 1

_validate_resultsFunction · 0.90

Calls 3

load_tensorsFunction · 0.85
joinMethod · 0.45
itemsMethod · 0.45

Tested by

no test coverage detected