Skip to content

Commit e35460c

Browse files
committed
test: add setup and teardown methods to reset TensorFlow graph in bias standard tests
1 parent c4e0924 commit e35460c

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

source/tests/tf/test_out_bias_std.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
from deepmd.tf.descriptor.se_a import (
88
DescrptSeA,
99
)
10+
from deepmd.tf.env import (
11+
tf,
12+
)
1013
from deepmd.tf.fit.dipole import (
1114
DipoleFittingSeA,
1215
)
@@ -21,6 +24,16 @@
2124
class TestOutBiasStd(unittest.TestCase):
2225
"""Test out_bias and out_std functionality in TensorFlow backend."""
2326

27+
def setUp(self):
28+
"""Resets the default graph before each test."""
29+
super().setUp()
30+
tf.reset_default_graph()
31+
32+
def tearDown(self):
33+
"""Resets the default graph after each test."""
34+
tf.reset_default_graph()
35+
super().tearDown()
36+
2437
def test_init_out_stat_basic(self):
2538
"""Test basic init_out_stat functionality."""
2639
descriptor = DescrptSeA(

0 commit comments

Comments
 (0)