Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/tensorflow/python/saved_model/registration/__init__.py: 100%

15 statements  

« prev     ^ index     » next       coverage.py v7.4.0, created at 2024-01-03 07:57 +0000

1# Copyright 2022 The TensorFlow Authors. All Rights Reserved. 

2# 

3# Licensed under the Apache License, Version 2.0 (the "License"); 

4# you may not use this file except in compliance with the License. 

5# You may obtain a copy of the License at 

6# 

7# http://www.apache.org/licenses/LICENSE-2.0 

8# 

9# Unless required by applicable law or agreed to in writing, software 

10# distributed under the License is distributed on an "AS IS" BASIS, 

11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 

12# See the License for the specific language governing permissions and 

13# limitations under the License. 

14# ============================================================================== 

15"""Utilities for registering the saving/loading steps for advanced objects.""" 

16 

17from tensorflow.python.saved_model.registration.registration import get_registered_class 

18from tensorflow.python.saved_model.registration.registration import get_registered_class_name 

19from tensorflow.python.saved_model.registration.registration import get_registered_saver_name 

20from tensorflow.python.saved_model.registration.registration import get_restore_function 

21from tensorflow.python.saved_model.registration.registration import get_save_function 

22from tensorflow.python.saved_model.registration.registration import get_strict_predicate_restore 

23 

24# These are currently an evolving feature. Use with care. 

25from tensorflow.python.saved_model.registration.registration import register_checkpoint_saver 

26from tensorflow.python.saved_model.registration.registration import register_serializable 

27 

28from tensorflow.python.saved_model.registration.registration import RegisteredSaver 

29from tensorflow.python.saved_model.registration.registration import validate_restore_function 

30 

31 

32def register_tf_serializable(name=None, predicate=None): 

33 """See the docstring for `register_serializable`.""" 

34 return register_serializable(package="tf", name=name, predicate=predicate) 

35 

36 

37def register_tf_checkpoint_saver(name=None, 

38 predicate=None, 

39 save_fn=None, 

40 restore_fn=None, 

41 strict_predicate_restore=True): 

42 """See the docstring for `register_checkpoint_saver`.""" 

43 return register_checkpoint_saver( 

44 package="tf", 

45 name=name, 

46 predicate=predicate, 

47 save_fn=save_fn, 

48 restore_fn=restore_fn, 

49 strict_predicate_restore=strict_predicate_restore)