deepmd.backend.suffix#
Functions#
| Check and format the suffixes of a filename. |
Module Contents#
- 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 formatting. 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:
strThe formatted filename with the correct suffix.
- Raises:
ValueErrorWhen preferred_backend is not given and the filename is not supported by any backend.