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

Method _testScope

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

Source from the content-addressed store, hash-verified

2296 np.ones((max_time, batch_size, 1), np.int64), output_vals[1])
2297
2298 def _testScope(self, factory, prefix="prefix", use_outer_scope=True):
2299 with self.session(use_gpu=True, graph=ops.Graph()):
2300 if use_outer_scope:
2301 with variable_scope.variable_scope(prefix) as scope:
2302 factory(scope)
2303 else:
2304 factory(prefix)
2305 variables_lib.global_variables_initializer()
2306
2307 # check that all the variables names starts
2308 # with the proper scope.
2309 all_vars = variables_lib.global_variables()
2310 prefix = prefix or "rnn"
2311 scope_vars = [v for v in all_vars if v.name.startswith(prefix + "/")]
2312 tf_logging.info("RNN with scope: %s (%s)" %
2313 (prefix, "scope" if use_outer_scope else "str"))
2314 for v in scope_vars:
2315 tf_logging.info(v.name)
2316 self.assertEqual(len(scope_vars), len(all_vars))
2317
2318 @test_util.run_v1_only("b/124229375")
2319 def testRawRNNScope(self):

Callers 1

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