Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/tensorflow/_api/v2/compat/v1/saved_model/loader/__init__.py: 100%

4 statements  

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

1# This file is MACHINE GENERATED! Do not edit. 

2# Generated by: tensorflow/python/tools/api/generator/create_python_api.py script. 

3"""Loader functionality for SavedModel with hermetic, language-neutral exports. 

4 

5Load and restore capability for a SavedModel, which may include multiple meta 

6graph defs. Each SavedModel is associated with a single checkpoint. Each meta 

7graph def is saved with one or more tags, which are used to identify the exact 

8meta graph def to load. 

9 

10The `load` operation requires the session in which to restore the graph 

11definition and variables, the tags used to identify the meta graph def to 

12load and the location of the SavedModel. 

13 

14Upon a load, the subset of variables and assets supplied as part of the specific 

15meta graph def, will be restored into the supplied session. The values of the 

16variables though will correspond to the saved values from the first meta graph 

17added to the SavedModel using `add_meta_graph_and_variables(...)` in 

18`builder.py`. 

19 

20Typical usage: 

21 

22```python 

23... 

24builder = tf.compat.v1.saved_model.builder.SavedModelBuilder(export_dir) 

25 

26with tf.compat.v1.Session(graph=tf.Graph()) as sess: 

27 ... 

28 builder.add_meta_graph_and_variables(sess, 

29 ["foo-tag"], 

30 signature_def_map=foo_signatures, 

31 assets_collection=foo_assets) 

32... 

33 

34with tf.compat.v1.Session(graph=tf.Graph()) as sess: 

35 ... 

36 builder.add_meta_graph(["bar-tag", "baz-tag"], 

37 assets_collection=bar_baz_assets) 

38... 

39 

40builder.save() 

41 

42... 

43with tf.compat.v1.Session(graph=tf.Graph()) as sess: 

44 tf.compat.v1.saved_model.loader.load(sess, ["foo-tag"], export_dir) 

45 ... 

46 

47``` 

48 

49""" 

50 

51import sys as _sys 

52 

53from tensorflow.python.saved_model.loader_impl import load 

54from tensorflow.python.saved_model.loader_impl import maybe_saved_model_directory