From 66bc1f65635459da5610b869fa88a9f949499078 Mon Sep 17 00:00:00 2001 From: Muhammed Fatih BALIN Date: Wed, 21 Aug 2024 15:43:12 +0000 Subject: [PATCH] fix the lint and naming --- python/dgl/graphbolt/impl/cpu_cached_feature.py | 5 +++-- python/dgl/graphbolt/impl/gpu_cached_feature.py | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/python/dgl/graphbolt/impl/cpu_cached_feature.py b/python/dgl/graphbolt/impl/cpu_cached_feature.py index fac664558a55..8f0a6d3b6c2d 100644 --- a/python/dgl/graphbolt/impl/cpu_cached_feature.py +++ b/python/dgl/graphbolt/impl/cpu_cached_feature.py @@ -437,7 +437,7 @@ def update(self, value: torch.Tensor, ids: torch.Tensor = None): feat0 = value[:1] self._fallback_feature.update(value) cache_size = min( - bytes_to_number_of_items(self.max_cache_size_in_bytes, feat0), + bytes_to_number_of_items(self.cache_size_in_bytes, feat0), value.shape[0], ) self._feature = None # Destroy the existing cache first. @@ -452,7 +452,8 @@ def is_pinned(self): return self._feature.is_pinned() @property - def max_cache_size_in_bytes(self): + def cache_size_in_bytes(self): + """Return the size taken by the cache in bytes.""" return self._feature.max_size_in_bytes @property diff --git a/python/dgl/graphbolt/impl/gpu_cached_feature.py b/python/dgl/graphbolt/impl/gpu_cached_feature.py index 7b1ea4a1b7ee..f110c1c32d5d 100644 --- a/python/dgl/graphbolt/impl/gpu_cached_feature.py +++ b/python/dgl/graphbolt/impl/gpu_cached_feature.py @@ -237,7 +237,7 @@ def update(self, value: torch.Tensor, ids: torch.Tensor = None): feat0 = value[:1] self._fallback_feature.update(value) cache_size = min( - bytes_to_number_of_items(self.max_cache_size_in_bytes, feat0), + bytes_to_number_of_items(self.cache_size_in_bytes, feat0), value.shape[0], ) self._feature = None # Destroy the existing cache first. @@ -249,7 +249,8 @@ def update(self, value: torch.Tensor, ids: torch.Tensor = None): self._feature.replace(ids, value) @property - def max_cache_size_in_bytes(self): + def cache_size_in_bytes(self): + """Return the size taken by the cache in bytes.""" return self._feature.max_size_in_bytes @property