Skip to content

Commit ce7fe95

Browse files
committed
fix: special case of single frame dataset
1 parent 0fa2fbe commit ce7fe95

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

deepmd/utils/data.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -603,7 +603,7 @@ def _get_nframes(self, set_name: DPPath) -> int:
603603
shape, fortran_order, dtype = np.lib.format.read_array_header_2_0(f)
604604
else:
605605
raise ValueError(f"Unsupported .npy file version: {version}")
606-
nframes = shape[0]
606+
nframes = shape[0] if (len(shape) if isinstance(shape, tuple) else 0) > 1 else 1
607607
return nframes
608608

609609
def reformat_data_torch(self, data: dict[str, Any]) -> dict[str, Any]:

0 commit comments

Comments
 (0)