MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / setUp

Method setUp

tensorflow/python/framework/test_util.py:1826–1845  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1824 self._cached_session = None
1825
1826 def setUp(self):
1827 self._ClearCachedSession()
1828 random.seed(random_seed.DEFAULT_GRAPH_SEED)
1829 np.random.seed(random_seed.DEFAULT_GRAPH_SEED)
1830 # Note: The following line is necessary because some test methods may error
1831 # out from within nested graph contexts (e.g., via assertRaises and
1832 # assertRaisesRegexp), which may leave ops._default_graph_stack non-empty
1833 # under certain versions of Python. That would cause
1834 # ops.reset_default_graph() to throw an exception if the stack were not
1835 # cleared first.
1836 ops._default_graph_stack.reset() # pylint: disable=protected-access
1837 ops.reset_default_graph()
1838 random_seed.set_random_seed(random_seed.DEFAULT_GRAPH_SEED)
1839 # Reset summary writer in case another test used set_as_default() with their
1840 # summary writer.
1841 context.context().summary_writer = None
1842
1843 # Avoiding calling setUp() for the poorly named test_session method.
1844 if self.id().endswith(".test_session"):
1845 self.skipTest("Not a test.")
1846
1847 def tearDown(self):
1848 for thread in self._threads:

Callers 1

decoratedFunction · 0.45

Calls 5

_ClearCachedSessionMethod · 0.95
seedMethod · 0.45
resetMethod · 0.45
contextMethod · 0.45
idMethod · 0.45

Tested by

no test coverage detected