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

Method test_optimizer

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

Source from the content-addressed store, hash-verified

240 _import_and_infer(save_dir, {"x": 2.}))
241
242 def test_optimizer(self):
243 x = constant_op.constant([[3., 4.]])
244 y = constant_op.constant([2.])
245 model = _ModelWithOptimizer()
246 first_loss = model.call(x, y)
247 save_dir = os.path.join(self.get_temp_dir(), "saved_model")
248 save.save(model, save_dir, model.call)
249 second_loss = model.call(x, y)
250 self.assertNotEqual(first_loss, second_loss)
251 self.assertAllClose(
252 second_loss,
253 _import_and_infer(save_dir, {"x": [[3., 4.]], "y": [2.]}))
254
255 def test_single_method_default_signature(self):
256 model = _ModelWithOptimizer()

Callers

nothing calls this directly

Calls 8

get_temp_dirMethod · 0.80
_ModelWithOptimizerClass · 0.70
_import_and_inferFunction · 0.70
constantMethod · 0.45
callMethod · 0.45
joinMethod · 0.45
saveMethod · 0.45
assertAllCloseMethod · 0.45

Tested by

no test coverage detected