(self)
| 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.]]) |
nothing calls this directly
no test coverage detected