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

Method replace

python/dgl/graphbolt/impl/cpu_feature_cache.py:152–171  ·  view source on GitHub ↗

Inserts key-value pairs into the cache using the selected caching policy algorithm to remove old key-value pairs if it is full. Parameters ---------- keys : Tensor The keys to insert to the cache. values : Tensor The values to insert t

(self, keys, values, offsets=None, offset=0)

Source from the content-addressed store, hash-verified

150 return values
151
152 def replace(self, keys, values, offsets=None, offset=0):
153 """Inserts key-value pairs into the cache using the selected caching
154 policy algorithm to remove old key-value pairs if it is full.
155
156 Parameters
157 ----------
158 keys : Tensor
159 The keys to insert to the cache.
160 values : Tensor
161 The values to insert to the cache.
162 offsets : Tensor, optional
163 The partition offsets of the keys.
164 offset : int
165 The offset to be added to the keys. Default is 0.
166 """
167 positions, pointers, offsets = self._policy.replace(
168 keys, offsets, offset
169 )
170 self._cache.replace(positions, values)
171 self._policy.writing_completed(pointers, offsets)
172
173 @property
174 def miss_rate(self):

Callers 2

test_feature_cacheFunction · 0.95
query_and_replaceMethod · 0.45

Calls

no outgoing calls

Tested by 1

test_feature_cacheFunction · 0.76