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

Function toindex

python/dgl/utils/internal.py:287–304  ·  view source on GitHub ↗

Convert the given data to Index object. Parameters ---------- data : index data Data to create the index. Returns ------- Index The index object. See Also -------- Index

(data, dtype="int64")

Source from the content-addressed store, hash-verified

285
286
287def toindex(data, dtype="int64"):
288 """Convert the given data to Index object.
289
290 Parameters
291 ----------
292 data : index data
293 Data to create the index.
294
295 Returns
296 -------
297 Index
298 The index object.
299
300 See Also
301 --------
302 Index
303 """
304 return data if isinstance(data, Index) else Index(data, dtype)
305
306
307def zero_index(size, dtype="int64"):

Callers 11

test_pickling_indexFunction · 0.90
l0_sampleFunction · 0.90
set_diffFunction · 0.85
reorder_indexFunction · 0.85
_distributed_accessFunction · 0.85
sample_etype_neighborsFunction · 0.85
sample_neighborsFunction · 0.85
_distributed_edge_accessFunction · 0.85

Calls 1

IndexClass · 0.85

Tested by 2

test_pickling_indexFunction · 0.72