MCPcopy Create free account
hub / github.com/alibaba/graph-learn / __init__

Method __init__

graphlearn/python/data/values.py:171–187  ·  view source on GitHub ↗

Init a SparseBase object. Args: offsets: list or 1D ndarraay, the number of values on each line. dense_shape: the corresponding 2D dense shape.

(self, offsets, dense_shape)

Source from the content-addressed store, hash-verified

169 """
170
171 def __init__(self, offsets, dense_shape):
172 """ Init a SparseBase object.
173 Args:
174 offsets: list or 1D ndarraay, the number of values on each line.
175 dense_shape: the corresponding 2D dense shape.
176 """
177 self._it = 0
178 self._offsets = offsets
179 self._dense_shape = dense_shape
180 self._global_offsets = [0]
181
182 sum_offsets = 0
183 for offset in self._offsets:
184 sum_offsets += offset
185 self._global_offsets.append(sum_offsets)
186
187 self._reset_indices()
188
189 @property
190 def offsets(self):

Callers

nothing calls this directly

Calls 2

_reset_indicesMethod · 0.95
appendMethod · 0.45

Tested by

no test coverage detected