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

Method test_variables_name

tensorflow/python/saved_model/load_test.py:115–129  ·  view source on GitHub ↗
(self, cycles)

Source from the content-addressed store, hash-verified

113 self.assertFalse(imported.v2.trainable)
114
115 def test_variables_name(self, cycles):
116 root = tracking.AutoTrackable()
117 # Test 2 variables with same name: should work as the checkpoint
118 # is based on object name and not on variable name.
119 root.v1 = variables.Variable(1., trainable=True, name="v1")
120 root.v2 = variables.Variable(2., trainable=False, name="v1")
121 imported = cycle(root, cycles)
122 self.assertEqual(imported.v1.numpy(), 1.0)
123 self.assertEqual(imported.v2.numpy(), 2.0)
124 self.assertEqual(imported.v1.name, root.v1.name)
125 self.assertEqual(imported.v2.name, root.v2.name)
126 with variable_scope.variable_scope("foo"):
127 imported = cycle(root, cycles)
128 self.assertTrue(imported.v1.name.startswith("foo/"))
129 self.assertTrue(imported.v2.name.startswith("foo/"))
130
131 def test_partially_defined_variable_shape(self, cycles):
132

Callers

nothing calls this directly

Calls 4

cycleFunction · 0.85
VariableMethod · 0.80
variable_scopeMethod · 0.80
numpyMethod · 0.45

Tested by

no test coverage detected