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

Method test_variable

tensorflow/python/saved_model/save_test.py:229–240  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

227 save.save(root, save_dir, to_save)
228
229 def test_variable(self):
230 root = tracking.AutoTrackable()
231 root.v1 = variables.Variable(3.)
232 root.v2 = variables.Variable(2.)
233 root.f = def_function.function(
234 lambda x: root.v1 * root.v2 * x)
235 root.f(constant_op.constant(1.))
236 to_save = root.f.get_concrete_function(constant_op.constant(1.))
237 save_dir = os.path.join(self.get_temp_dir(), "saved_model")
238 save.save(root, save_dir, to_save)
239 self.assertAllEqual({"output_0": 12.},
240 _import_and_infer(save_dir, {"x": 2.}))
241
242 def test_optimizer(self):
243 x = constant_op.constant([[3., 4.]])

Callers

nothing calls this directly

Calls 10

VariableMethod · 0.80
get_temp_dirMethod · 0.80
_import_and_inferFunction · 0.70
functionMethod · 0.45
fMethod · 0.45
constantMethod · 0.45
get_concrete_functionMethod · 0.45
joinMethod · 0.45
saveMethod · 0.45
assertAllEqualMethod · 0.45

Tested by

no test coverage detected