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

Method flatten

python/dgl/frame.py:34–42  ·  view source on GitHub ↗

Evaluate the chain of indices, and return a single index tensor.

(self)

Source from the content-addressed store, hash-verified

32 return _LazyIndex(self._indices + [index])
33
34 def flatten(self):
35 """Evaluate the chain of indices, and return a single index tensor."""
36 flat_index = self._indices[0]
37 # here we actually need to resolve it
38 for index in self._indices[1:]:
39 if F.context(index) != F.context(flat_index):
40 index = F.copy_to(index, F.context(flat_index))
41 flat_index = F.gather_row(flat_index, index)
42 return flat_index
43
44 def record_stream(self, stream):
45 """Record stream for index.

Callers 15

invoke_udf_reduceFunction · 0.80
dataMethod · 0.80
_reduce_gradFunction · 0.80
_assert_is_sortedFunction · 0.80
_normalizeFunction · 0.80
get_epsMethod · 0.80
get_epsMethod · 0.80
get_epsMethod · 0.80
forwardMethod · 0.80
forward_blockMethod · 0.80
test_topkFunction · 0.80
_print_errorFunction · 0.80

Calls 2

contextMethod · 0.80
copy_toMethod · 0.45

Tested by 6

test_topkFunction · 0.64
_print_errorFunction · 0.64
test_heterograph_mergeFunction · 0.64
_print_errorFunction · 0.64
_print_errorFunction · 0.64
test_gatconv_equalityFunction · 0.64