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

Method test_assets

tensorflow/python/saved_model/load_test.py:202–222  ·  view source on GitHub ↗
(self, cycles)

Source from the content-addressed store, hash-verified

200
201 @test_util.run_in_graph_and_eager_modes
202 def test_assets(self, cycles):
203 file1 = self._make_asset("contents 1")
204 file2 = self._make_asset("contents 2")
205
206 root = tracking.AutoTrackable()
207 root.asset1 = tracking.TrackableAsset(file1)
208 root.asset2 = tracking.TrackableAsset(file2)
209
210 save_dir = os.path.join(self.get_temp_dir(), "save_dir")
211 save.save(root, save_dir)
212
213 file_io.delete_file(file1)
214 file_io.delete_file(file2)
215 load_dir = os.path.join(self.get_temp_dir(), "load_dir")
216 file_io.rename(save_dir, load_dir)
217
218 imported = load.load(load_dir)
219 with open(self.evaluate(imported.asset1.asset_path), "r") as f:
220 self.assertEqual("contents 1", f.read())
221 with open(self.evaluate(imported.asset2.asset_path), "r") as f:
222 self.assertEqual("contents 2", f.read())
223
224 def test_cond_prune(self, cycles):
225 x_in = []

Callers

nothing calls this directly

Calls 7

_make_assetMethod · 0.95
get_temp_dirMethod · 0.80
joinMethod · 0.45
saveMethod · 0.45
loadMethod · 0.45
evaluateMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected