deepmd.backend.suffix
Module Contents
Functions
| Check and format the suffixes of a filename. |
- deepmd.backend.suffix.format_model_suffix(filename: str, feature: deepmd.backend.backend.Backend.Feature | None = None, preferred_backend: str | Type[deepmd.backend.backend.Backend] | None = None, strict_prefer: bool | None = None) str [source]
Check and format the suffixes of a filename.
When preferred_backend is not given, this method checks the suffix of the filename is within the suffixes of the any backends (with the given feature) and doesn’t do formating. When preferred_backend is given, strict_prefer must be given. If strict_prefer is True and the suffix is not within the suffixes of the preferred backend, or strict_prefer is False and the suffix is not within the suffixes of the any backend with the given feature, the filename will be formatted with the preferred suffix of the preferred backend.
- Parameters:
- Returns:
str
The formatted filename with the correct suffix.
- Raises:
ValueError
When preferred_backend is not given and the filename is not supported by any backend.