Strictify Python targets in tensorflow/python/saved_model/.
PiperOrigin-RevId: 320071367 Change-Id: Ib2848e4a6bb9f06ad2f506145c17a82ceba6bba4
This commit is contained in:
		
							parent
							
								
									586744d2e4
								
							
						
					
					
						commit
						216ac563c7
					
				| @ -1,6 +1,7 @@ | ||||
| # Description: | ||||
| # TensorFlow SavedModel. | ||||
| 
 | ||||
| load("//tensorflow:tensorflow.bzl", "py_strict_library") | ||||
| load("//tensorflow:tensorflow.bzl", "cuda_py_test") | ||||
| 
 | ||||
| # buildifier: disable=same-origin-load | ||||
| @ -15,7 +16,7 @@ package( | ||||
| 
 | ||||
| exports_files(["LICENSE"]) | ||||
| 
 | ||||
| py_library( | ||||
| py_strict_library( | ||||
|     name = "saved_model", | ||||
|     srcs = ["saved_model.py"], | ||||
|     srcs_version = "PY2AND3", | ||||
| @ -37,28 +38,28 @@ py_library( | ||||
|     ], | ||||
| ) | ||||
| 
 | ||||
| py_library( | ||||
| py_strict_library( | ||||
|     name = "constants", | ||||
|     srcs = ["constants.py"], | ||||
|     srcs_version = "PY2AND3", | ||||
|     deps = ["//tensorflow/python:util"], | ||||
|     deps = ["//tensorflow/python:tf_export"], | ||||
| ) | ||||
| 
 | ||||
| py_library( | ||||
| py_strict_library( | ||||
|     name = "signature_constants", | ||||
|     srcs = ["signature_constants.py"], | ||||
|     srcs_version = "PY2AND3", | ||||
|     deps = ["//tensorflow/python:util"], | ||||
|     deps = ["//tensorflow/python:tf_export"], | ||||
| ) | ||||
| 
 | ||||
| py_library( | ||||
| py_strict_library( | ||||
|     name = "tag_constants", | ||||
|     srcs = ["tag_constants.py"], | ||||
|     srcs_version = "PY2AND3", | ||||
|     deps = ["//tensorflow/python:util"], | ||||
|     deps = ["//tensorflow/python:tf_export"], | ||||
| ) | ||||
| 
 | ||||
| py_library( | ||||
| py_strict_library( | ||||
|     name = "builder", | ||||
|     srcs = [ | ||||
|         "builder.py", | ||||
| @ -67,18 +68,20 @@ py_library( | ||||
|     srcs_version = "PY2AND3", | ||||
|     deps = [ | ||||
|         ":constants", | ||||
|         ":signature_def_utils", | ||||
|         ":utils", | ||||
|         "//tensorflow/core:protos_all_py", | ||||
|         "//tensorflow/python:framework_for_generated_wrappers", | ||||
|         "//tensorflow/python:lib", | ||||
|         "//tensorflow/python:platform", | ||||
|         "//tensorflow/python:saver", | ||||
|         "//tensorflow/python:tf_export", | ||||
|         "//tensorflow/python:util", | ||||
|         "//tensorflow/python:variables", | ||||
|     ], | ||||
| ) | ||||
| 
 | ||||
| py_library( | ||||
| py_strict_library( | ||||
|     name = "loader", | ||||
|     srcs = [ | ||||
|         "loader.py", | ||||
| @ -94,6 +97,7 @@ py_library( | ||||
|         "//tensorflow/python:lib", | ||||
|         "//tensorflow/python:platform", | ||||
|         "//tensorflow/python:saver", | ||||
|         "//tensorflow/python:tf_export", | ||||
|         "//tensorflow/python:util", | ||||
|         "//tensorflow/python:variables", | ||||
|     ], | ||||
| @ -121,7 +125,7 @@ tf_py_test( | ||||
|     ], | ||||
| ) | ||||
| 
 | ||||
| py_library( | ||||
| py_strict_library( | ||||
|     name = "simple_save", | ||||
|     srcs = [ | ||||
|         "simple_save.py", | ||||
| @ -132,13 +136,13 @@ py_library( | ||||
|         ":signature_constants", | ||||
|         ":signature_def_utils", | ||||
|         ":tag_constants", | ||||
|         "//tensorflow/core:protos_all_py", | ||||
|         "//tensorflow/python:lib", | ||||
|         "//tensorflow/python:framework_ops", | ||||
|         "//tensorflow/python:tf_export", | ||||
|         "//tensorflow/python:util", | ||||
|     ], | ||||
| ) | ||||
| 
 | ||||
| py_library( | ||||
| py_strict_library( | ||||
|     name = "main_op", | ||||
|     srcs = [ | ||||
|         "main_op.py", | ||||
| @ -149,6 +153,7 @@ py_library( | ||||
|         "//tensorflow/python:control_flow_ops", | ||||
|         "//tensorflow/python:framework_for_generated_wrappers", | ||||
|         "//tensorflow/python:lookup_ops", | ||||
|         "//tensorflow/python:tf_export", | ||||
|         "//tensorflow/python:util", | ||||
|         "//tensorflow/python:variables", | ||||
|     ], | ||||
| @ -185,7 +190,7 @@ tf_py_test( | ||||
|     ], | ||||
| ) | ||||
| 
 | ||||
| py_library( | ||||
| py_strict_library( | ||||
|     name = "utils", | ||||
|     srcs = [ | ||||
|         "utils.py", | ||||
| @ -196,10 +201,13 @@ py_library( | ||||
|         ":constants", | ||||
|         ":nested_structure_coder", | ||||
|         "//tensorflow/core:protos_all_py", | ||||
|         "//tensorflow/python:composite_tensor", | ||||
|         "//tensorflow/python:framework_for_generated_wrappers", | ||||
|         "//tensorflow/python:lib", | ||||
|         "//tensorflow/python:sparse_tensor", | ||||
|         "//tensorflow/python:tf_export", | ||||
|         "//tensorflow/python:util", | ||||
|         "//tensorflow/python/eager:context", | ||||
|     ], | ||||
| ) | ||||
| 
 | ||||
| @ -217,7 +225,7 @@ tf_py_test( | ||||
|     ], | ||||
| ) | ||||
| 
 | ||||
| py_library( | ||||
| py_strict_library( | ||||
|     name = "signature_def_utils", | ||||
|     srcs = [ | ||||
|         "signature_def_utils.py", | ||||
| @ -228,7 +236,9 @@ py_library( | ||||
|         ":signature_constants", | ||||
|         ":utils", | ||||
|         "//tensorflow/core:protos_all_py", | ||||
|         "//tensorflow/python:errors", | ||||
|         "//tensorflow/python:framework_ops", | ||||
|         "//tensorflow/python:tf_export", | ||||
|         "//tensorflow/python:util", | ||||
|     ], | ||||
| ) | ||||
| @ -263,16 +273,18 @@ tf_py_test( | ||||
|     ], | ||||
| ) | ||||
| 
 | ||||
| py_library( | ||||
| py_strict_library( | ||||
|     name = "signature_serialization", | ||||
|     srcs = [ | ||||
|         "signature_serialization.py", | ||||
|     ], | ||||
|     srcs_version = "PY2AND3", | ||||
|     deps = [ | ||||
|         ":function_serialization", | ||||
|         ":revived_types", | ||||
|         ":signature_constants", | ||||
|         "//tensorflow/python:framework_ops", | ||||
|         "//tensorflow/python:resource_variable_ops", | ||||
|         "//tensorflow/python:tensor_spec", | ||||
|         "//tensorflow/python:util", | ||||
|         "//tensorflow/python/eager:def_function", | ||||
| @ -281,7 +293,7 @@ py_library( | ||||
|     ], | ||||
| ) | ||||
| 
 | ||||
| py_library( | ||||
| py_strict_library( | ||||
|     name = "save_context", | ||||
|     srcs = [ | ||||
|         "save_context.py", | ||||
| @ -290,7 +302,7 @@ py_library( | ||||
|     deps = [], | ||||
| ) | ||||
| 
 | ||||
| py_library( | ||||
| py_strict_library( | ||||
|     name = "save", | ||||
|     srcs = [ | ||||
|         "save.py", | ||||
| @ -314,16 +326,22 @@ py_library( | ||||
|         "//tensorflow/python:constant_op", | ||||
|         "//tensorflow/python:control_flow_ops", | ||||
|         "//tensorflow/python:dtypes", | ||||
|         "//tensorflow/python:error_interpolation", | ||||
|         "//tensorflow/python:errors", | ||||
|         "//tensorflow/python:framework", | ||||
|         "//tensorflow/python:framework_ops", | ||||
|         "//tensorflow/python:lib", | ||||
|         "//tensorflow/python:resource_variable_ops", | ||||
|         "//tensorflow/python:tensor_util", | ||||
|         "//tensorflow/python:tf_export", | ||||
|         "//tensorflow/python:util", | ||||
|         "//tensorflow/python:versions", | ||||
|         "//tensorflow/python/eager:context", | ||||
|         "//tensorflow/python/eager:def_function", | ||||
|         "//tensorflow/python/eager:function", | ||||
|         "//tensorflow/python/training/saving:checkpoint_options", | ||||
|         "//tensorflow/python/training/saving:functional_saver", | ||||
|         "//tensorflow/python/training/saving:saveable_object_util", | ||||
|         "//tensorflow/python/training/tracking", | ||||
|         "//tensorflow/python/training/tracking:base", | ||||
|         "//tensorflow/python/training/tracking:graph_view", | ||||
| @ -349,14 +367,13 @@ tf_py_test( | ||||
|     ], | ||||
| ) | ||||
| 
 | ||||
| py_library( | ||||
| py_strict_library( | ||||
|     name = "load", | ||||
|     srcs = [ | ||||
|         "load.py", | ||||
|     ], | ||||
|     srcs_version = "PY2AND3", | ||||
|     deps = [ | ||||
|         ":constants", | ||||
|         ":function_deserialization", | ||||
|         ":load_options", | ||||
|         ":load_v1_in_v2", | ||||
| @ -365,17 +382,25 @@ py_library( | ||||
|         ":revived_types", | ||||
|         ":utils", | ||||
|         "//tensorflow/core:protos_all_py", | ||||
|         "//tensorflow/python:array_ops", | ||||
|         "//tensorflow/python:constant_op", | ||||
|         "//tensorflow/python:control_flow_ops", | ||||
|         "//tensorflow/python:dtypes", | ||||
|         "//tensorflow/python:errors", | ||||
|         "//tensorflow/python:framework_ops", | ||||
|         "//tensorflow/python:init_ops", | ||||
|         "//tensorflow/python:lib", | ||||
|         "//tensorflow/python:gradients", | ||||
|         "//tensorflow/python:lookup_ops", | ||||
|         "//tensorflow/python:resource_variable_ops", | ||||
|         "//tensorflow/python:tensor_util", | ||||
|         "//tensorflow/python:tf_export", | ||||
|         "//tensorflow/python:util", | ||||
|         "//tensorflow/python:variables", | ||||
|         "//tensorflow/python/distribute:distribute_lib", | ||||
|         "//tensorflow/python/distribute:distribute_utils", | ||||
|         "//tensorflow/python/distribute:values", | ||||
|         "//tensorflow/python/eager:context", | ||||
|         "//tensorflow/python/eager:function", | ||||
|         "//tensorflow/python/training/saving:checkpoint_options", | ||||
|         "//tensorflow/python/training/saving:saveable_object_util", | ||||
|         "//tensorflow/python/training/tracking", | ||||
|         "//tensorflow/python/training/tracking:base", | ||||
|         "//tensorflow/python/training/tracking:graph_view", | ||||
| @ -383,17 +408,26 @@ py_library( | ||||
|     ], | ||||
| ) | ||||
| 
 | ||||
| py_library( | ||||
| py_strict_library( | ||||
|     name = "load_v1_in_v2", | ||||
|     srcs = [ | ||||
|         "load_v1_in_v2.py", | ||||
|     ], | ||||
|     srcs_version = "PY2AND3", | ||||
|     deps = [ | ||||
|         ":function_deserialization", | ||||
|         ":loader", | ||||
|         ":signature_serialization", | ||||
|         "//tensorflow/python:array_ops", | ||||
|         "//tensorflow/python:constant_op", | ||||
|         "//tensorflow/python:dtypes", | ||||
|         "//tensorflow/python:framework_ops", | ||||
|         "//tensorflow/python:platform", | ||||
|         "//tensorflow/python:saver", | ||||
|         "//tensorflow/python:sparse_tensor", | ||||
|         "//tensorflow/python:training_lib", | ||||
|         "//tensorflow/python/eager:context", | ||||
|         "//tensorflow/python/eager:lift_to_graph", | ||||
|         "//tensorflow/python/eager:wrap_function", | ||||
|         "//tensorflow/python/training/tracking", | ||||
|     ], | ||||
| @ -451,7 +485,7 @@ tf_py_test( | ||||
|     ], | ||||
| ) | ||||
| 
 | ||||
| py_library( | ||||
| py_strict_library( | ||||
|     name = "revived_types", | ||||
|     srcs = [ | ||||
|         "revived_types.py", | ||||
| @ -472,7 +506,7 @@ tf_py_test( | ||||
|     ], | ||||
| ) | ||||
| 
 | ||||
| py_library( | ||||
| py_strict_library( | ||||
|     name = "function_serialization", | ||||
|     srcs = [ | ||||
|         "function_serialization.py", | ||||
| @ -481,12 +515,13 @@ py_library( | ||||
|     deps = [ | ||||
|         ":nested_structure_coder", | ||||
|         "//tensorflow/core:protos_all_py", | ||||
|         "//tensorflow/python/eager:def_function", | ||||
|         "//tensorflow/python:func_graph", | ||||
|         "//tensorflow/python:util", | ||||
|         "//tensorflow/python/eager:function", | ||||
|     ], | ||||
| ) | ||||
| 
 | ||||
| py_library( | ||||
| py_strict_library( | ||||
|     name = "function_deserialization", | ||||
|     srcs = [ | ||||
|         "function_deserialization.py", | ||||
| @ -494,22 +529,42 @@ py_library( | ||||
|     srcs_version = "PY2AND3", | ||||
|     deps = [ | ||||
|         ":nested_structure_coder", | ||||
|         "//tensorflow/core:protos_all_py", | ||||
|         "//tensorflow/python:framework_ops", | ||||
|         "//tensorflow/python:func_graph", | ||||
|         "//tensorflow/python:function_def_to_graph", | ||||
|         "//tensorflow/python:op_def_registry", | ||||
|         "//tensorflow/python:platform", | ||||
|         "//tensorflow/python:resource_variable_ops", | ||||
|         "//tensorflow/python:tensor_spec", | ||||
|         "//tensorflow/python:tf_decorator", | ||||
|         "//tensorflow/python:type_spec", | ||||
|         "//tensorflow/python:util", | ||||
|         "//tensorflow/python/eager:def_function", | ||||
|         "//tensorflow/python/eager:function", | ||||
|     ], | ||||
| ) | ||||
| 
 | ||||
| py_library( | ||||
| py_strict_library( | ||||
|     name = "nested_structure_coder", | ||||
|     srcs = ["nested_structure_coder.py"], | ||||
|     deps = [ | ||||
|         "//tensorflow/core:protos_all_py", | ||||
|         "//tensorflow/python:framework", | ||||
|         "//tensorflow/python:dtypes", | ||||
|         "//tensorflow/python:indexed_slices", | ||||
|         "//tensorflow/python:resource_variable_ops", | ||||
|         "//tensorflow/python:sparse_tensor", | ||||
|         "//tensorflow/python:tensor_array_ops", | ||||
|         "//tensorflow/python:tensor_shape", | ||||
|         "//tensorflow/python:tensor_spec", | ||||
|         "//tensorflow/python:tensor_util", | ||||
|         "//tensorflow/python:util", | ||||
|         "//tensorflow/python/data/ops:dataset_ops", | ||||
|         "//tensorflow/python/data/ops:iterator_ops", | ||||
|         "//tensorflow/python/data/ops:optional_ops", | ||||
|         "//tensorflow/python/distribute:values", | ||||
|         "//tensorflow/python/ops/ragged", | ||||
|         "//tensorflow/python/ops/ragged:ragged_tensor", | ||||
|         "//tensorflow/python/ops/ragged:row_partition", | ||||
|         "@six_archive//:six", | ||||
|     ], | ||||
| ) | ||||
| @ -525,22 +580,25 @@ tf_py_test( | ||||
|     ], | ||||
| ) | ||||
| 
 | ||||
| py_library( | ||||
| py_strict_library( | ||||
|     name = "save_options", | ||||
|     srcs = ["save_options.py"], | ||||
|     deps = [ | ||||
|         "//tensorflow/python:tf_export", | ||||
|         "//tensorflow/python:util", | ||||
|         "@six_archive//:six", | ||||
|     ], | ||||
| ) | ||||
| 
 | ||||
| py_library( | ||||
| py_strict_library( | ||||
|     name = "load_options", | ||||
|     srcs = ["load_options.py"], | ||||
|     deps = [ | ||||
|         "//tensorflow/python:tf_export", | ||||
|     ], | ||||
| ) | ||||
| 
 | ||||
| py_library( | ||||
| py_strict_library( | ||||
|     name = "method_name_updater", | ||||
|     srcs = ["method_name_updater.py"], | ||||
|     srcs_version = "PY2AND3", | ||||
| @ -549,6 +607,7 @@ py_library( | ||||
|         ":loader", | ||||
|         "//tensorflow/python:lib", | ||||
|         "//tensorflow/python:platform", | ||||
|         "//tensorflow/python:tf_export", | ||||
|         "//tensorflow/python:util", | ||||
|     ], | ||||
| ) | ||||
|  | ||||
| @ -15,7 +15,12 @@ | ||||
| 
 | ||||
| # Description: | ||||
| #   Keras saving and loading libraries. | ||||
| load("//tensorflow:tensorflow.bzl", "py_test") | ||||
| 
 | ||||
| # buildifier: disable=same-origin-load | ||||
| load("//tensorflow:tensorflow.bzl", "py_strict_library") | ||||
| 
 | ||||
| # buildifier: disable=same-origin-load | ||||
| load("//tensorflow:tensorflow.bzl", "py_strict_test") | ||||
| 
 | ||||
| package( | ||||
|     default_visibility = ["//tensorflow:__subpackages__"], | ||||
| @ -24,7 +29,7 @@ package( | ||||
| 
 | ||||
| exports_files(["LICENSE"]) | ||||
| 
 | ||||
| py_library( | ||||
| py_strict_library( | ||||
|     name = "model_utils", | ||||
|     srcs = ["__init__.py"], | ||||
|     srcs_version = "PY2AND3", | ||||
| @ -35,7 +40,7 @@ py_library( | ||||
|     ], | ||||
| ) | ||||
| 
 | ||||
| py_library( | ||||
| py_strict_library( | ||||
|     name = "export_output", | ||||
|     srcs = ["export_output.py"], | ||||
|     srcs_version = "PY2AND3", | ||||
| @ -44,10 +49,11 @@ py_library( | ||||
|         "//tensorflow/python:dtypes", | ||||
|         "//tensorflow/python:framework_ops", | ||||
|         "//tensorflow/python/saved_model:signature_def_utils", | ||||
|         "@six_archive//:six", | ||||
|     ], | ||||
| ) | ||||
| 
 | ||||
| py_test( | ||||
| py_strict_test( | ||||
|     name = "export_output_test", | ||||
|     srcs = ["export_output_test.py"], | ||||
|     python_version = "PY3", | ||||
| @ -61,12 +67,14 @@ py_test( | ||||
|         "//tensorflow/python:control_flow_ops", | ||||
|         "//tensorflow/python:dtypes", | ||||
|         "//tensorflow/python:framework_ops", | ||||
|         "//tensorflow/python:metrics", | ||||
|         "//tensorflow/python:sparse_tensor", | ||||
|         "//tensorflow/python/eager:context", | ||||
|         "//tensorflow/python/saved_model:signature_constants", | ||||
|     ], | ||||
| ) | ||||
| 
 | ||||
| py_library( | ||||
| py_strict_library( | ||||
|     name = "export_utils", | ||||
|     srcs = ["export_utils.py"], | ||||
|     srcs_version = "PY2AND3", | ||||
| @ -78,36 +86,37 @@ py_library( | ||||
|         "//tensorflow/python/saved_model:signature_constants", | ||||
|         "//tensorflow/python/saved_model:signature_def_utils", | ||||
|         "//tensorflow/python/saved_model:tag_constants", | ||||
|         "@six_archive//:six", | ||||
|     ], | ||||
| ) | ||||
| 
 | ||||
| py_test( | ||||
| py_strict_test( | ||||
|     name = "export_test", | ||||
|     srcs = ["export_test.py"], | ||||
|     python_version = "PY3", | ||||
|     srcs_version = "PY2AND3", | ||||
|     deps = [ | ||||
|         ":export_output", | ||||
|         ":export_utils", | ||||
|         ":mode_keys", | ||||
|         "//tensorflow/python:array_ops", | ||||
|         "//tensorflow/python:client_testlib", | ||||
|         "//tensorflow/python:constant_op", | ||||
|         "//tensorflow/python:control_flow_ops", | ||||
|         "//tensorflow/python:dtypes", | ||||
|         "//tensorflow/python:framework_ops", | ||||
|         "//tensorflow/python:framework_test_lib", | ||||
|         "//tensorflow/python:sparse_tensor", | ||||
|         "//tensorflow/python/saved_model:signature_constants", | ||||
|         "//tensorflow/python/saved_model:signature_def_utils", | ||||
|     ], | ||||
| ) | ||||
| 
 | ||||
| py_library( | ||||
| py_strict_library( | ||||
|     name = "mode_keys", | ||||
|     srcs = ["mode_keys.py"], | ||||
|     srcs_version = "PY2AND3", | ||||
|     deps = ["//tensorflow/python:util"], | ||||
| ) | ||||
| 
 | ||||
| py_test( | ||||
| py_strict_test( | ||||
|     name = "mode_keys_test", | ||||
|     srcs = ["mode_keys_test.py"], | ||||
|     python_version = "PY3", | ||||
|  | ||||
| @ -1932,6 +1932,10 @@ register_extension_info( | ||||
| def py_strict_library(name, **kwargs): | ||||
|     native.py_library(name = name, **kwargs) | ||||
| 
 | ||||
| # Placeholder to use until bazel supports py_strict_test. | ||||
| def py_strict_test(name, **kwargs): | ||||
|     native.py_test(name = name, **kwargs) | ||||
| 
 | ||||
| def tf_custom_op_py_library( | ||||
|         name, | ||||
|         srcs = [], | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user