Inserts key-value pairs into the GPU cache using the Least-Recently Used (LRU) algorithm to remove old key-value pairs if it is full. Parameters ---------- keys: Tensor The keys to insert to the GPU cache. values: Tensor The values to
(self, keys, values)
| 61 | ) |
| 62 | |
| 63 | def replace(self, keys, values): |
| 64 | """Inserts key-value pairs into the GPU cache using the Least-Recently |
| 65 | Used (LRU) algorithm to remove old key-value pairs if it is full. |
| 66 | |
| 67 | Parameters |
| 68 | ---------- |
| 69 | keys: Tensor |
| 70 | The keys to insert to the GPU cache. |
| 71 | values: Tensor |
| 72 | The values to insert to the GPU cache. |
| 73 | """ |
| 74 | keys = F.astype(keys, self.idtype) |
| 75 | values = F.astype(values, F.float32) |
| 76 | _CAPI_DGLGpuCacheReplace( |
| 77 | self._cache, F.to_dgl_nd(keys), F.to_dgl_nd(values) |
| 78 | ) |
| 79 | |
| 80 | @property |
| 81 | def miss_rate(self): |