diff --git a/tensorflow/c/BUILD b/tensorflow/c/BUILD index c9fd7aabca3..0b31ca33d20 100644 --- a/tensorflow/c/BUILD +++ b/tensorflow/c/BUILD @@ -242,7 +242,7 @@ cc_library( visibility = ["//visibility:public"], deps = select({ "//tensorflow:android": [ - "//tensorflow/core:android_tensorflow_lib_lite", + "//tensorflow/core:android_tensorflow_lib_lite", # TODO(annarev): exclude runtime srcs ], "//conditions:default": [ "//tensorflow/core:framework", diff --git a/tensorflow/core/framework/BUILD b/tensorflow/core/framework/BUILD index a5fdc15af9e..5cf57e82357 100644 --- a/tensorflow/core/framework/BUILD +++ b/tensorflow/core/framework/BUILD @@ -272,6 +272,7 @@ filegroup( "log_memory.cc", "log_memory.h", "numeric_types.h", + "op_requires.h", "register_types.h", "resource_handle.cc", "resource_handle.h", @@ -353,7 +354,6 @@ filegroup( "op_def_util.h", "op_kernel.cc", "op_kernel.h", - "op_requires.h", "op_segment.cc", "op_segment.h", "ops_util.cc", @@ -866,6 +866,7 @@ cc_library( "//tensorflow/core/platform:strcat", "//tensorflow/core/platform:stringpiece", "//tensorflow/core/platform:types", + "//tensorflow/core/util:padding", "@com_google_absl//absl/strings", ], ) diff --git a/tensorflow/core/framework/node_def_util.cc b/tensorflow/core/framework/node_def_util.cc index 573b3080cd9..04de2d5b2b0 100644 --- a/tensorflow/core/framework/node_def_util.cc +++ b/tensorflow/core/framework/node_def_util.cc @@ -419,6 +419,13 @@ bool TryGetNodeAttr(const AttrSlice& attrs, StringPiece attr_name, return true; } +Status GetNodeAttr(const AttrSlice& attrs, StringPiece attr_name, + Padding* value) { + string str_value; + TF_RETURN_IF_ERROR(GetNodeAttr(attrs, attr_name, &str_value)); + return GetPaddingFromString(str_value, value); +} + namespace { // Helper for InOutTypesForNode(). template diff --git a/tensorflow/core/framework/node_def_util.h b/tensorflow/core/framework/node_def_util.h index 88adb296141..fe26901c807 100644 --- a/tensorflow/core/framework/node_def_util.h +++ b/tensorflow/core/framework/node_def_util.h @@ -34,6 +34,7 @@ limitations under the License. #include "tensorflow/core/platform/status.h" #include "tensorflow/core/platform/stringpiece.h" #include "tensorflow/core/platform/types.h" +#include "tensorflow/core/util/padding.h" namespace tensorflow { @@ -304,6 +305,10 @@ bool TryGetNodeAttr( // REQUIRES: Must not use the returned value beyond the lifetime of node_def. const string& GetNodeAttrString(const AttrSlice& attrs, StringPiece attr_name); +// Specialization to parse an attribute directly into a Padding enum. +Status GetNodeAttr(const AttrSlice& attrs, StringPiece attr_name, + Padding* value); + // Computes the input type for a specific node input. // REQUIRES: ValidateOpDef(op_def).ok() Status InputTypeForNode(const NodeDef& node_def, const OpDef& op_def, diff --git a/tensorflow/core/kernels/BUILD b/tensorflow/core/kernels/BUILD index 1dcda06479d..f8b70f9b6a4 100644 --- a/tensorflow/core/kernels/BUILD +++ b/tensorflow/core/kernels/BUILD @@ -3953,10 +3953,15 @@ cc_library( "aggregate_ops.h", "aggregate_ops_cpu.h", ], - deps = [ - "//tensorflow/core:framework", - "//third_party/eigen3", - ], + deps = select({ + "//tensorflow:android": [ + "//tensorflow/core:android_tensorflow_lib_lite", # TODO(annarev): exclude runtime srcs + ], + "//conditions:default": [ + "//third_party/eigen3", + "//tensorflow/core:framework", + ], + }), ) tf_kernel_library( diff --git a/tensorflow/core/util/BUILD b/tensorflow/core/util/BUILD index 58203b8bf6c..8cf5ac9fcfe 100644 --- a/tensorflow/core/util/BUILD +++ b/tensorflow/core/util/BUILD @@ -47,6 +47,10 @@ filegroup( name = "mobile_srcs_no_runtime", srcs = [ "overflow.h", + "padding.cc", + "padding.h", + "tensor_format.cc", + "tensor_format.h", ], ) @@ -81,8 +85,6 @@ filegroup( "matmul_bcast.h", "mirror_pad_mode.cc", "mirror_pad_mode.h", - "padding.cc", - "padding.h", "port.cc", "port.h", "presized_cuckoo_map.h", @@ -94,8 +96,6 @@ filegroup( "stat_summarizer.h", "strided_slice_op.cc", "strided_slice_op.h", - "tensor_format.cc", - "tensor_format.h", "tensor_ops_util.h", "tensor_slice_reader.cc", "tensor_slice_reader.h", @@ -465,7 +465,6 @@ cc_library( 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", ], diff --git a/tensorflow/core/util/padding.cc b/tensorflow/core/util/padding.cc index 11a46877fe4..5fa33d8a590 100644 --- a/tensorflow/core/util/padding.cc +++ b/tensorflow/core/util/padding.cc @@ -16,18 +16,10 @@ limitations under the License. #include "tensorflow/core/util/padding.h" #include "tensorflow/core/framework/attr_value.pb.h" -#include "tensorflow/core/framework/node_def_util.h" #include "tensorflow/core/lib/core/errors.h" namespace tensorflow { -Status GetNodeAttr(const AttrSlice& attrs, StringPiece attr_name, - Padding* value) { - string str_value; - TF_RETURN_IF_ERROR(GetNodeAttr(attrs, attr_name, &str_value)); - return GetPaddingFromString(str_value, value); -} - Status GetPaddingFromString(StringPiece str_value, Padding* value) { if (str_value == "SAME") { *value = SAME; diff --git a/tensorflow/core/util/padding.h b/tensorflow/core/util/padding.h index d6b92aefd09..7b63277fc5c 100644 --- a/tensorflow/core/util/padding.h +++ b/tensorflow/core/util/padding.h @@ -22,7 +22,6 @@ limitations under the License. #include #include -#include "tensorflow/core/framework/node_def_util.h" #include "tensorflow/core/lib/core/status.h" #include "tensorflow/core/util/tensor_format.h" @@ -60,10 +59,6 @@ string GetPaddingAttrStringWithExplicit(); string GetExplicitPaddingsAttrString(); -// Specialization to parse an attribute directly into a Padding enum. -Status GetNodeAttr(const AttrSlice& attrs, StringPiece attr_name, - Padding* value); - // Sets padding value based on the given string padding value. Status GetPaddingFromString(StringPiece str_value, Padding* value);