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

Method _testScope

tensorflow/python/kernel_tests/rnn_cell_test.py:2006–2024  ·  view source on GitHub ↗
(self, factory, prefix="prefix", use_outer_scope=True)

Source from the content-addressed store, hash-verified

2004 sess.run([outputs_dynamic, state_dynamic], feed_dict=feeds)
2005
2006 def _testScope(self, factory, prefix="prefix", use_outer_scope=True):
2007 with self.session(use_gpu=True, graph=ops.Graph()):
2008 if use_outer_scope:
2009 with variable_scope.variable_scope(prefix) as scope:
2010 factory(scope)
2011 else:
2012 factory(prefix)
2013 variables_lib.global_variables_initializer()
2014
2015 # check that all the variables names starts
2016 # with the proper scope.
2017 all_vars = variables_lib.global_variables()
2018 prefix = prefix or "rnn"
2019 scope_vars = [v for v in all_vars if v.name.startswith(prefix + "/")]
2020 tf_logging.info("RNN with scope: %s (%s)" %
2021 (prefix, "scope" if use_outer_scope else "str"))
2022 for v in scope_vars:
2023 tf_logging.info(v.name)
2024 self.assertEqual(len(scope_vars), len(all_vars))
2025
2026 @test_util.run_v1_only("b/124229375")
2027 def testDynamicScope(self):

Callers 1

testDynamicScopeMethod · 0.95

Calls 6

factoryFunction · 0.85
variable_scopeMethod · 0.80
infoMethod · 0.80
sessionMethod · 0.45
GraphMethod · 0.45
global_variablesMethod · 0.45

Tested by

no test coverage detected