From b6d0218c34877767c33f2d1832734ce83c69a8c0 Mon Sep 17 00:00:00 2001 From: Anna R Date: Mon, 6 Jan 2020 13:24:56 -0800 Subject: [PATCH] Split out common_shape_fns and shape_inference into their own targets in third_party/tensorflow/core/framework/BUILD. Also, split out einsum_op_util, padding and tensor_format in third_party/tensorflow/core/util/BUILD. PiperOrigin-RevId: 288363061 Change-Id: Idfb4d46a7f084ce613b255274ddd4f28110050ab --- tensorflow/core/BUILD | 5 ++++ tensorflow/core/framework/BUILD | 50 +++++++++++++++++++++++++++++---- tensorflow/core/util/BUILD | 42 +++++++++++++++++++++++++-- 3 files changed, 89 insertions(+), 8 deletions(-) diff --git a/tensorflow/core/BUILD b/tensorflow/core/BUILD index c5e2c493ff8..23aa2c91a74 100644 --- a/tensorflow/core/BUILD +++ b/tensorflow/core/BUILD @@ -2525,11 +2525,13 @@ tf_cuda_library( "//tensorflow/core/framework:attr_value_proto_text", "//tensorflow/core/framework:attr_value_util", "//tensorflow/core/framework:bfloat16", + "//tensorflow/core/framework:common_shape_fns", "//tensorflow/core/framework:node_def_util", "//tensorflow/core/framework:numeric_types", "//tensorflow/core/framework:op_def_builder", "//tensorflow/core/framework:op_def_util", "//tensorflow/core/framework:resource_handle", + "//tensorflow/core/framework:shape_inference", "//tensorflow/core/framework:tensor", "//tensorflow/core/framework:tensor_shape", "//tensorflow/core/kernels:bounds_check", @@ -2537,8 +2539,11 @@ tf_cuda_library( "//tensorflow/core/profiler/internal:annotation_stack_impl", "//tensorflow/core/profiler/internal:traceme_recorder_impl", "//tensorflow/core/profiler/lib:traceme", + "//tensorflow/core/util:einsum_op_util", + "//tensorflow/core/util:padding", "//tensorflow/core/util:port", "//tensorflow/core/util:stats_calculator_portable", + "//tensorflow/core/util:tensor_format", "//tensorflow/compiler/jit:common", ] + if_static( extra_deps = ["@com_google_protobuf//:protobuf"], diff --git a/tensorflow/core/framework/BUILD b/tensorflow/core/framework/BUILD index 29d48ff4f34..53942511c76 100644 --- a/tensorflow/core/framework/BUILD +++ b/tensorflow/core/framework/BUILD @@ -30,7 +30,6 @@ exports_files( "allocator_registry.h", "cancellation.h", "collective.h", - "common_shape_fns.h", "control_flow.h", "dataset.h", "dataset_stateful_op_whitelist.h", @@ -64,7 +63,6 @@ exports_files( "run_handler_util.h", "selective_registration.h", "session_state.h", - "shape_inference.h", "shared_ptr_variant.h", "stats_aggregator.h", "tensor_reference.h", @@ -210,7 +208,6 @@ filegroup( srcs = [ "cancellation.cc", "collective.cc", - "common_shape_fns.cc", "dataset.cc", "device_base.cc", "function.cc", @@ -234,7 +231,6 @@ filegroup( "resource_mgr.cc", "run_handler.cc", "run_handler_util.cc", - "shape_inference.cc", "tensor_slice.cc", "tensor_util.cc", "unique_tensor_references.cc", @@ -688,7 +684,10 @@ tf_cuda_library( "variant_op_registry.h", "variant_tensor_data.h", ], - visibility = ["//tensorflow/core:__pkg__"], + visibility = [ + "//tensorflow/core:__pkg__", + "//tensorflow/core/util:__pkg__", + ], deps = [ ":allocation_description_proto_cc", ":allocator", @@ -731,6 +730,47 @@ tf_cuda_library( alwayslink = 1, ) +cc_library( + name = "shape_inference", + srcs = ["shape_inference.cc"], + hdrs = ["shape_inference.h"], + deps = [ + ":bounds_check", + ":node_def_proto_cc", + ":node_def_util", + ":tensor", + ":tensor_shape", + ":tensor_shape_proto_cc", + "//tensorflow/core/lib/core:errors", + "//tensorflow/core/lib/core:status", + "//tensorflow/core/lib/gtl:inlined_vector", + "//tensorflow/core/lib/strings:numbers", + "//tensorflow/core/lib/strings:scanner", + "//tensorflow/core/lib/strings:str_util", + "//tensorflow/core/platform:macros", + "@com_google_absl//absl/memory", + ], +) + +cc_library( + name = "common_shape_fns", + srcs = ["common_shape_fns.cc"], + hdrs = ["common_shape_fns.h"], + deps = [ + ":attr_value_proto_cc", + ":shape_inference", + ":tensor", + ":tensor_shape", + "//tensorflow/core/lib/core:errors", + "//tensorflow/core/lib/gtl:inlined_vector", + "//tensorflow/core/util:einsum_op_util", + "//tensorflow/core/util:padding", + "//tensorflow/core/util:tensor_format", + "@com_google_absl//absl/container:flat_hash_map", + "@com_google_absl//absl/strings", + ], +) + cc_library( name = "attr_value_util", srcs = ["attr_value_util.cc"], diff --git a/tensorflow/core/util/BUILD b/tensorflow/core/util/BUILD index 8568507cafd..2e4ea69659e 100644 --- a/tensorflow/core/util/BUILD +++ b/tensorflow/core/util/BUILD @@ -35,7 +35,6 @@ exports_files( "debug_events_writer.h", "device_name_utils.h", "dump_graph.h", - "einsum_op_util.h", "env_var.h", "equal_graph_def.h", "events_writer.h", @@ -50,7 +49,6 @@ exports_files( "memmapped_file_system_writer.h", "mirror_pad_mode.h", "mkl_util.h", - "padding.h", "permutation_input_iterator.h", "permutation_output_iterator.h", "port.h", @@ -60,7 +58,6 @@ exports_files( "stat_summarizer_options.h", "stats_calculator.h", "strided_slice_op.h", - "tensor_format.h", "tensor_slice_reader.h", "tensor_slice_reader_cache.h", "tensor_slice_set.h", @@ -150,12 +147,15 @@ filegroup( ], exclude = [ "*test*", + "einsum_op_util.cc", "env_var.cc", "memmapped_file_system.*", "memmapped_file_system_writer.*", + "padding.cc", "port.cc", "reporter.cc", "stats_calculator.cc", + "tensor_format.cc", "version_info.cc", ], ), @@ -389,6 +389,42 @@ cc_library( copts = tf_copts(), ) +cc_library( + name = "tensor_format", + srcs = ["tensor_format.cc"], + hdrs = ["tensor_format.h"], + deps = [ + "//tensorflow/core:lib", + "//tensorflow/core/framework:tensor", + "//tensorflow/core/platform:types", + ], +) + +cc_library( + name = "padding", + srcs = ["padding.cc"], + hdrs = ["padding.h"], + deps = [ + ":tensor_format", + "//tensorflow/core/framework:attr_value_proto_cc", + "//tensorflow/core/framework:node_def_util", + "//tensorflow/core/lib/core:errors", + "//tensorflow/core/lib/core:status", + ], +) + +cc_library( + name = "einsum_op_util", + srcs = ["einsum_op_util.cc"], + hdrs = ["einsum_op_util.h"], + deps = [ + "//tensorflow/core:lib", + "//tensorflow/core/lib/core:errors", + "//tensorflow/core/lib/core:status", + "@com_google_absl//absl/strings", + ], +) + # Tests. tf_cc_test(