(obj, cycles, signatures=None)
| 71 | |
| 72 | |
| 73 | def cycle(obj, cycles, signatures=None): |
| 74 | to_save = obj |
| 75 | # TODO(vbardiovsky): It would be nice if exported protos reached a fixed |
| 76 | # point w.r.t. saving/restoring, ideally after 2nd saving. |
| 77 | for _ in range(cycles): |
| 78 | path = tempfile.mkdtemp(prefix=test.get_temp_dir()) |
| 79 | # If available, we'll run the save and restore preferring the GPU. This |
| 80 | # just makes sure we aren't throwing errors and have enough |
| 81 | # device("CPU") blocks to satisfy the placer. |
| 82 | with test_util.use_gpu(): |
| 83 | save.save(to_save, path, signatures) |
| 84 | loaded = load.load(path) |
| 85 | to_save = loaded |
| 86 | return loaded |
| 87 | |
| 88 | |
| 89 | @parameterized.named_parameters( |
no test coverage detected