add save load test for pathlib path
This commit is contained in:
parent
41da235fd0
commit
1363f0f6e8
|
@ -71,6 +71,12 @@ class TestSaveModel(test.TestCase, parameterized.TestCase):
|
||||||
save.save_model(self.model, path)
|
save.save_model(self.model, path)
|
||||||
self.assert_saved_model(path)
|
self.assert_saved_model(path)
|
||||||
|
|
||||||
|
@test_util.run_v2_only
|
||||||
|
def test_save_format_defaults_pathlib(self):
|
||||||
|
path = pathlib.Path(self.get_temp_dir()) / 'model_path'
|
||||||
|
save.save_model(self.model, path)
|
||||||
|
self.assert_saved_model(path)
|
||||||
|
|
||||||
@test_util.run_v2_only
|
@test_util.run_v2_only
|
||||||
def test_save_hdf5(self):
|
def test_save_hdf5(self):
|
||||||
path = os.path.join(self.get_temp_dir(), 'model')
|
path = os.path.join(self.get_temp_dir(), 'model')
|
||||||
|
@ -81,6 +87,13 @@ class TestSaveModel(test.TestCase, parameterized.TestCase):
|
||||||
'requires the model to be a Functional model or a Sequential model.'):
|
'requires the model to be a Functional model or a Sequential model.'):
|
||||||
save.save_model(self.subclassed_model, path, save_format='h5')
|
save.save_model(self.subclassed_model, path, save_format='h5')
|
||||||
|
|
||||||
|
@test_util.run_v2_only
|
||||||
|
def test_save_load_hdf5_pathlib(self):
|
||||||
|
if sys.version_info >= (3, 6):
|
||||||
|
path = pathlib.Path(self.get_temp_dir()) / 'model'
|
||||||
|
save.save_model(self.model, path, save_format='h5')
|
||||||
|
save.load_model(path)
|
||||||
|
|
||||||
@test_util.run_v2_only
|
@test_util.run_v2_only
|
||||||
def test_save_tf(self):
|
def test_save_tf(self):
|
||||||
path = os.path.join(self.get_temp_dir(), 'model')
|
path = os.path.join(self.get_temp_dir(), 'model')
|
||||||
|
|
Loading…
Reference in New Issue