Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix pt bug: missing get_ntype method #3612

Merged
merged 2 commits into from
Mar 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions deepmd/pt/model/model/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,8 @@
def get_model_def_script(self) -> str:
"""Get the model definition script."""
return self.model_def_script

@torch.jit.export
def get_ntypes(self):

Check warning on line 50 in deepmd/pt/model/model/model.py

View check run for this annotation

Codecov / codecov/patch

deepmd/pt/model/model/model.py#L49-L50

Added lines #L49 - L50 were not covered by tests
"""Returns the number of element types."""
return len(self.get_type_map())

Check warning on line 52 in deepmd/pt/model/model/model.py

View check run for this annotation

Codecov / codecov/patch

deepmd/pt/model/model/model.py#L52

Added line #L52 was not covered by tests