From 2da89167cb7352256e3adfb5144beb5752c2ed36 Mon Sep 17 00:00:00 2001 From: kozistr Date: Sun, 5 May 2024 17:17:48 +0900 Subject: [PATCH] update: test_emcmc --- tests/test_utils.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/test_utils.py b/tests/test_utils.py index a02355620..245c44276 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -22,6 +22,7 @@ neuron_norm, normalize_gradient, reduce_max_except_dim, + reg_noise, to_real, unit_norm, ) @@ -228,3 +229,13 @@ def test_max_reduce_except_dim(): x = torch.zeros((1, 1)) with pytest.raises(ValueError): reduce_max_except_dim(x, 3) + + +def test_emcmc(): + torch.random.manual_seed(42) + + network1 = Example() + network2 = Example() + + loss = reg_noise(network1, network2, int(5e4), 1e-1).detach().numpy() + np.testing.assert_almost_equal(loss, 0.0011383)