From 11278e427014da92926aedba96fe14897a25290a Mon Sep 17 00:00:00 2001 From: Shan Han Date: Tue, 15 Aug 2023 22:53:16 -0700 Subject: [PATCH] Format and fix a few files. PiperOrigin-RevId: 557359718 --- tensorflow/core/common_runtime/BUILD | 5 +++-- tensorflow/core/common_runtime/request_cost.cc | 3 +++ tensorflow/core/common_runtime/request_cost.h | 2 ++ .../core/common_runtime/request_cost_test.cc | 3 ++- tensorflow/core/kernels/batching_util/BUILD | 8 ++++++-- .../kernels/batching_util/batch_resource_base.cc | 1 + .../kernels/batching_util/batch_resource_base.h | 3 ++- .../batching_util/batch_resource_base_test.cc | 16 +++++++++++++--- 8 files changed, 32 insertions(+), 9 deletions(-) diff --git a/tensorflow/core/common_runtime/BUILD b/tensorflow/core/common_runtime/BUILD index a8d66b7086b145..236026e70b8625 100644 --- a/tensorflow/core/common_runtime/BUILD +++ b/tensorflow/core/common_runtime/BUILD @@ -2118,8 +2118,10 @@ cc_library( hdrs = ["request_cost.h"], visibility = ["//visibility:public"], deps = [ + "@com_google_absl//absl/base:core_headers", "@com_google_absl//absl/container:flat_hash_map", "@com_google_absl//absl/strings", + "@com_google_absl//absl/synchronization", "@com_google_absl//absl/time", ], ) @@ -3193,9 +3195,8 @@ tf_cc_test( srcs = ["request_cost_test.cc"], deps = [ ":request_cost", - "//tensorflow/core:test", - "//tensorflow/core:test_main", "@com_google_absl//absl/time", + "@com_google_googletest//:gtest_main", ], ) diff --git a/tensorflow/core/common_runtime/request_cost.cc b/tensorflow/core/common_runtime/request_cost.cc index 258b7002010a3c..b3f3bc2096b290 100644 --- a/tensorflow/core/common_runtime/request_cost.cc +++ b/tensorflow/core/common_runtime/request_cost.cc @@ -15,10 +15,13 @@ limitations under the License. #include "tensorflow/core/common_runtime/request_cost.h" +#include #include #include +#include "absl/container/flat_hash_map.h" #include "absl/strings/string_view.h" +#include "absl/synchronization/mutex.h" #include "absl/time/time.h" namespace tensorflow { diff --git a/tensorflow/core/common_runtime/request_cost.h b/tensorflow/core/common_runtime/request_cost.h index 191bcc4d99266d..a77c952f94620f 100644 --- a/tensorflow/core/common_runtime/request_cost.h +++ b/tensorflow/core/common_runtime/request_cost.h @@ -20,8 +20,10 @@ limitations under the License. #include #include +#include "absl/base/thread_annotations.h" #include "absl/container/flat_hash_map.h" #include "absl/strings/string_view.h" +#include "absl/synchronization/mutex.h" #include "absl/time/time.h" namespace tensorflow { diff --git a/tensorflow/core/common_runtime/request_cost_test.cc b/tensorflow/core/common_runtime/request_cost_test.cc index e62c7b848738e6..8ce3877546a8cc 100644 --- a/tensorflow/core/common_runtime/request_cost_test.cc +++ b/tensorflow/core/common_runtime/request_cost_test.cc @@ -15,8 +15,9 @@ limitations under the License. #include "tensorflow/core/common_runtime/request_cost.h" +#include +#include #include "absl/time/time.h" -#include "tensorflow/core/platform/test.h" namespace tensorflow { namespace { diff --git a/tensorflow/core/kernels/batching_util/BUILD b/tensorflow/core/kernels/batching_util/BUILD index 2419ac09545781..9740dcb0c32afb 100644 --- a/tensorflow/core/kernels/batching_util/BUILD +++ b/tensorflow/core/kernels/batching_util/BUILD @@ -393,12 +393,16 @@ tf_cc_test( srcs = ["batch_resource_base_test.cc"], deps = [ ":batch_resource_base", - "//tensorflow/core:test", - "//tensorflow/core:test_main", + "//tensorflow/core:framework", "//tensorflow/core/common_runtime:cost_measurement", "//tensorflow/core/common_runtime:cost_measurement_registry", "//tensorflow/core/common_runtime:no_op_cost_measurement", + "//tensorflow/core/common_runtime:request_cost", + "//tensorflow/core/framework:types_proto_cc", + "@com_google_absl//absl/memory", + "@com_google_absl//absl/strings", "@com_google_absl//absl/time", + "@com_google_googletest//:gtest_main", ], ) diff --git a/tensorflow/core/kernels/batching_util/batch_resource_base.cc b/tensorflow/core/kernels/batching_util/batch_resource_base.cc index 3910282de01c92..b9eb458ec819b6 100644 --- a/tensorflow/core/kernels/batching_util/batch_resource_base.cc +++ b/tensorflow/core/kernels/batching_util/batch_resource_base.cc @@ -16,6 +16,7 @@ limitations under the License. #include "tensorflow/core/kernels/batching_util/batch_resource_base.h" #include +#include #include #include #include diff --git a/tensorflow/core/kernels/batching_util/batch_resource_base.h b/tensorflow/core/kernels/batching_util/batch_resource_base.h index c65bdf45ae4315..391edd0f26276b 100644 --- a/tensorflow/core/kernels/batching_util/batch_resource_base.h +++ b/tensorflow/core/kernels/batching_util/batch_resource_base.h @@ -16,6 +16,7 @@ limitations under the License. #ifndef TENSORFLOW_CORE_KERNELS_BATCHING_UTIL_BATCH_RESOURCE_BASE_H_ #define TENSORFLOW_CORE_KERNELS_BATCHING_UTIL_BATCH_RESOURCE_BASE_H_ +#include #include #include #include @@ -233,7 +234,7 @@ class BatchResourceBase : public ResourceBase { // padding's size. Here padding's cost is not assigned to any tasks. static void SplitBatchCosts( std::vector>& batch_cost_measurements, - const int64_t processed_size, BatchT& batch); + int64_t processed_size, BatchT& batch); private: // Implementation of calling the process batch function. diff --git a/tensorflow/core/kernels/batching_util/batch_resource_base_test.cc b/tensorflow/core/kernels/batching_util/batch_resource_base_test.cc index 28dd2edb86c877..48a3efbc0eb1fb 100644 --- a/tensorflow/core/kernels/batching_util/batch_resource_base_test.cc +++ b/tensorflow/core/kernels/batching_util/batch_resource_base_test.cc @@ -15,11 +15,21 @@ limitations under the License. #include "tensorflow/core/kernels/batching_util/batch_resource_base.h" +#include +#include +#include + +#include +#include +#include "absl/memory/memory.h" +#include "absl/strings/string_view.h" #include "absl/time/time.h" #include "tensorflow/core/common_runtime/cost_measurement.h" #include "tensorflow/core/common_runtime/cost_measurement_registry.h" -#include "tensorflow/core/common_runtime/no_op_cost_measurement.h" -#include "tensorflow/core/platform/test.h" +#include "tensorflow/core/common_runtime/request_cost.h" +#include "tensorflow/core/framework/tensor.h" +#include "tensorflow/core/framework/tensor_shape.h" +#include "tensorflow/core/framework/types.pb.h" namespace tensorflow { namespace serving { @@ -48,7 +58,7 @@ REGISTER_COST_MEASUREMENT("test_gcu", TestGcuCostMeasurement); std::unique_ptr MakeBatchTask( const int64_t task_size, RequestCost* request_cost) { - auto task = absl::make_unique(); + auto task = std::make_unique(); task->inputs.push_back(Tensor(DT_DOUBLE, TensorShape({task_size, 1}))); task->request_cost = request_cost; return task;