Skip to content

Commit 6986773

Browse files
committed
refactor: streamline batch count calculation by removing unnecessary data loading
1 parent 3052a78 commit 6986773

1 file changed

Lines changed: 2 additions & 6 deletions

File tree

deepmd/utils/data.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -339,12 +339,8 @@ def get_numb_set(self) -> int:
339339
def get_numb_batch(self, batch_size: int, set_idx: int) -> int:
340340
"""Get the number of batches in a set."""
341341
set_name = self.dirs[set_idx]
342-
if isinstance(set_name, DPH5Path):
343-
data = self._load_set(set_name)
344-
nframes = data["coord"].shape[0]
345-
else:
346-
# Directly obtain the number of frames to avoid loading the entire dataset
347-
nframes = self._get_nframes(set_name)
342+
# Directly obtain the number of frames to avoid loading the entire dataset
343+
nframes = self._get_nframes(set_name)
348344
ret = nframes // batch_size
349345
if ret == 0:
350346
ret = 1

0 commit comments

Comments
 (0)