Skip to content

Commit

Permalink
Add tests for different activation types.
Browse files Browse the repository at this point in the history
  • Loading branch information
Shyue Ping Ong committed Aug 1, 2023
1 parent 5b6d65c commit 4aa0038
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
4 changes: 3 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ check-filenames = true

[tool.coverage.run]
relative_files = true
omit = "cli.py"

[tool.coverage.report]
exclude_lines = [
Expand All @@ -114,5 +115,6 @@ exclude_lines = [
"raise AssertionError",
"raise NotImplementedError",
"input",
"if TYPE_CHECKING:"
"if TYPE_CHECKING:",
"except PackageNotFoundError:"
]
7 changes: 4 additions & 3 deletions tests/models/test_m3gnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@
class TestM3GNet:
def test_model(self, graph_MoS):
structure, graph, state = graph_MoS
model = M3GNet(element_types=["Mo", "S"], is_intensive=False)
output = model(g=graph)
assert torch.numel(output) == 1
for act in ["swish", "tanh", "sigmoid", "softplus2", "softexp"]:
model = M3GNet(element_types=["Mo", "S"], is_intensive=False, activation_type=act)
output = model(g=graph)
assert torch.numel(output) == 1
model.save(".")
M3GNet.load(".")
os.remove("model.pt")
Expand Down

0 comments on commit 4aa0038

Please sign in to comment.