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

Method _testScope

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

Source from the content-addressed store, hash-verified

320 1.0 * (2 + 1) * np.ones((input_size)))))
321
322 def _testScope(self, factory, prefix="prefix", use_outer_scope=True):
323 with self.session(use_gpu=True, graph=ops.Graph()):
324 if use_outer_scope:
325 with variable_scope.variable_scope(prefix) as scope:
326 factory(scope)
327 else:
328 factory(prefix)
329
330 # check that all the variables names starts
331 # with the proper scope.
332 variables_lib.global_variables_initializer()
333 all_vars = variables_lib.global_variables()
334 prefix = prefix or "rnn"
335 scope_vars = [v for v in all_vars if v.name.startswith(prefix + "/")]
336 tf_logging.info("RNN with scope: %s (%s)" %
337 (prefix, "scope" if use_outer_scope else "str"))
338 for v in scope_vars:
339 tf_logging.info(v.name)
340 self.assertEqual(len(scope_vars), len(all_vars))
341
342 @test_util.run_v1_only("b/124229375")
343 def testScope(self):

Callers 1

testScopeMethod · 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