(self, factory, prefix="prefix", use_outer_scope=True)
| 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): |
no test coverage detected