Skip to content

Commit

Permalink
Make test model smaller and adjust np.allclose tolerances.
Browse files Browse the repository at this point in the history
  • Loading branch information
kaminow committed Oct 18, 2023
1 parent 2288017 commit ea86511
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions mtenn/tests/test_combination.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@
@pytest.fixture()
def models_and_inputs():
model_test = SchNet(
PygSchNet(
hidden_channels=16, num_filters=16, num_interactions=2, num_gaussians=2
)
PygSchNet(hidden_channels=2, num_filters=2, num_interactions=2, num_gaussians=2)
)
model_ref = deepcopy(model_test)
model_ref = SchNet.get_model(model_ref, strategy="complex")
Expand Down Expand Up @@ -56,7 +54,7 @@ def test_mean_combination(models_and_inputs):
ref_param_dict = dict(model_ref.named_parameters())
assert all(
[
np.allclose(p.grad, ref_param_dict[n].grad, atol=1e-7)
np.allclose(p.grad, ref_param_dict[n].grad, atol=5e-7)
for n, p in model_test.named_parameters()
]
)
Expand Down Expand Up @@ -88,7 +86,7 @@ def test_max_combination(models_and_inputs):
ref_param_dict = dict(model_ref.named_parameters())
assert all(
[
np.allclose(p.grad, ref_param_dict[n].grad, atol=1e-7)
np.allclose(p.grad, ref_param_dict[n].grad, atol=5e-7)
for n, p in model_test.named_parameters()
]
)
Expand Down Expand Up @@ -118,7 +116,7 @@ def test_boltzmann_combination(models_and_inputs):
ref_param_dict = dict(model_ref.named_parameters())
assert all(
[
np.allclose(p.grad, ref_param_dict[n].grad, atol=1e-7)
np.allclose(p.grad, ref_param_dict[n].grad, atol=5e-7)
for n, p in model_test.named_parameters()
]
)

0 comments on commit ea86511

Please sign in to comment.