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

Function load_labels

python/dgl/data/graph_serialize.py:222–254  ·  view source on GitHub ↗

Load label dict from file Parameters ---------- filename: str filename to load DGLGraphs Returns ---------- labels: dict dict of labels stored in file (empty dict returned if no label stored) Examples ---------- Following the exampl

(filename)

Source from the content-addressed store, hash-verified

220
221
222def load_labels(filename):
223 """
224 Load label dict from file
225
226 Parameters
227 ----------
228 filename: str
229 filename to load DGLGraphs
230
231 Returns
232 ----------
233 labels: dict
234 dict of labels stored in file (empty dict returned if no
235 label stored)
236
237 Examples
238 ----------
239 Following the example in save_graphs.
240
241 >>> from dgl.data.utils import load_labels
242 >>> label_dict = load_graphs("./data.bin")
243
244 """
245 # if it is local file, do some sanity check
246 check_local_file_exists(filename)
247
248 version = _CAPI_GetFileVersion(filename)
249 if version == 1:
250 return load_labels_v1(filename)
251 elif version == 2:
252 return load_labels_v2(filename)
253 else:
254 raise Exception("Invalid DGL Version Number")
255
256
257def load_labels_v2(filename):

Callers 2

test_load_old_files2Function · 0.85

Calls 3

check_local_file_existsFunction · 0.85
load_labels_v1Function · 0.85
load_labels_v2Function · 0.85

Tested by 2

test_load_old_files2Function · 0.68