| 252 | root.add(constant_op.constant(1.)) |
| 253 | |
| 254 | def test_capture_assets(self, cycles): |
| 255 | root = tracking.AutoTrackable() |
| 256 | root.vocab = tracking.TrackableAsset(self._make_asset("contents")) |
| 257 | root.f = def_function.function( |
| 258 | lambda: root.vocab.asset_path, |
| 259 | input_signature=[]) |
| 260 | imported = cycle(root, cycles) |
| 261 | original_output = root.f().numpy() |
| 262 | imported_output = imported.f().numpy() |
| 263 | self.assertNotEqual(original_output, imported_output) |
| 264 | with open(imported_output, "r") as f: |
| 265 | self.assertEqual("contents", f.read()) |
| 266 | |
| 267 | def test_capture_assets_in_graph(self, cycles): |
| 268 | root = tracking.AutoTrackable() |