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