From 818b768cdabbb5137e7d522a34c9754872fd50b7 Mon Sep 17 00:00:00 2001 From: "A. Unique TensorFlower" Date: Sat, 1 Jul 2017 08:23:11 -0700 Subject: [PATCH] Minor cleanup: remove unused constructions PiperOrigin-RevId: 160736783 --- .../compiler/jit/encapsulate_subgraphs_pass.cc | 1 - tensorflow/compiler/plugin/executor/compiler.cc | 17 ++++++----------- .../compiler/plugin/executor/executable.cc | 15 ++++++--------- tensorflow/compiler/plugin/executor/executor.cc | 14 ++++---------- .../xla/service/hlo_rematerialization_test.cc | 4 ++-- .../kernels/ensemble_optimizer_ops.cc | 1 - .../contrib/boosted_trees/kernels/model_ops.cc | 1 - .../contrib/tensor_forest/kernels/model_ops.cc | 1 - .../contrib/tensor_forest/kernels/stats_ops.cc | 1 - tensorflow/core/ops/state_ops.cc | 1 - tensorflow/python/framework/test_ops.cc | 1 - 11 files changed, 18 insertions(+), 39 deletions(-) diff --git a/tensorflow/compiler/jit/encapsulate_subgraphs_pass.cc b/tensorflow/compiler/jit/encapsulate_subgraphs_pass.cc index 14d8f2ab351..a1ddad3e9b8 100644 --- a/tensorflow/compiler/jit/encapsulate_subgraphs_pass.cc +++ b/tensorflow/compiler/jit/encapsulate_subgraphs_pass.cc @@ -25,7 +25,6 @@ limitations under the License. #include "tensorflow/compiler/tf2xla/dump_graph.h" #include "tensorflow/core/common_runtime/function.h" #include "tensorflow/core/common_runtime/optimization_registry.h" -#include "tensorflow/core/framework/attr_value.pb.h" #include "tensorflow/core/framework/function.h" #include "tensorflow/core/framework/graph_def_util.h" #include "tensorflow/core/framework/node_def_builder.h" diff --git a/tensorflow/compiler/plugin/executor/compiler.cc b/tensorflow/compiler/plugin/executor/compiler.cc index 3a84f08c005..72fe7ba4519 100644 --- a/tensorflow/compiler/plugin/executor/compiler.cc +++ b/tensorflow/compiler/plugin/executor/compiler.cc @@ -18,7 +18,6 @@ limitations under the License. #include "tensorflow/compiler/plugin/executor/compiler.h" #include "tensorflow/compiler/plugin/executor/executable.h" - #include "tensorflow/compiler/xla/service/algebraic_simplifier.h" #include "tensorflow/compiler/xla/service/flatten_call_graph.h" #include "tensorflow/compiler/xla/service/hlo_constant_folding.h" @@ -30,18 +29,15 @@ limitations under the License. #include "tensorflow/compiler/xla/service/inliner.h" #include "tensorflow/compiler/xla/service/reshape_mover.h" #include "tensorflow/compiler/xla/status_macros.h" - +#include "tensorflow/core/lib/core/errors.h" #include "tensorflow/stream_executor/lib/initialize.h" #include "tensorflow/stream_executor/lib/strcat.h" -#include "tensorflow/core/lib/core/errors.h" +namespace xla { +namespace executorplugin { namespace se = ::perftools::gputools; namespace sep = ::perftools::gputools::executorplugin; -namespace port = ::perftools::gputools::port; - -namespace xla { -namespace executorplugin { /* * Run optimization passes on the module. The graph is transformed by @@ -111,12 +107,11 @@ ExecutorCompiler::ShapeSizeBytesFunction() const { return ExecutorExecutable::ShapeSizeBytes; } - -} // namespace executorplugin -} // namespace xla - REGISTER_MODULE_INITIALIZER(executor_compiler, { xla::Compiler::RegisterCompilerFactory(sep::kExecutorPlatformId, []() { return xla::MakeUnique(); }); }); + +} // namespace executorplugin +} // namespace xla diff --git a/tensorflow/compiler/plugin/executor/executable.cc b/tensorflow/compiler/plugin/executor/executable.cc index 79eea9af3f0..4673a90e0a9 100644 --- a/tensorflow/compiler/plugin/executor/executable.cc +++ b/tensorflow/compiler/plugin/executor/executable.cc @@ -15,18 +15,16 @@ limitations under the License. #include "tensorflow/compiler/plugin/executor/executable.h" #include "tensorflow/compiler/plugin/executor/executor.h" - -#include "tensorflow/compiler/xla/service/hlo_evaluator.h" - #include "tensorflow/compiler/xla/literal_util.h" +#include "tensorflow/compiler/xla/service/hlo_evaluator.h" #include "tensorflow/compiler/xla/shape_util.h" -namespace se = ::perftools::gputools; -namespace sep = ::perftools::gputools::executorplugin; - namespace xla { namespace executorplugin { +namespace se = ::perftools::gputools; +namespace sep = ::perftools::gputools::executorplugin; + ExecutorExecutable::ExecutorExecutable(std::unique_ptr hlo_module) : Executable(std::move(hlo_module), ShapeSizeBytes) {} @@ -90,15 +88,14 @@ StatusOr ExecutorExecutable::ExecuteOnStream( arg_literals_ptrs.push_back(arg_literals.back().get()); // Copy in the data from the stream_executor buffers - void* buffer = arg_literals.back().get()->MutableInternalData(); + void* buffer = arg_literals.back()->MutableInternalData(); memcpy(buffer, arguments[p].opaque(), ShapeUtil::ByteSizeOf(param->shape())); } // Execute the graph using the evaluator HloEvaluator evaluator; - std::unique_ptr output; - TF_ASSIGN_OR_RETURN(output, + TF_ASSIGN_OR_RETURN(std::unique_ptr output, evaluator.Evaluate(computation, arg_literals_ptrs)); // Copy the result into the return buffer diff --git a/tensorflow/compiler/plugin/executor/executor.cc b/tensorflow/compiler/plugin/executor/executor.cc index e72c2711f79..908b996bc95 100644 --- a/tensorflow/compiler/plugin/executor/executor.cc +++ b/tensorflow/compiler/plugin/executor/executor.cc @@ -14,14 +14,12 @@ limitations under the License. ==============================================================================*/ #include "tensorflow/compiler/plugin/executor/executor.h" -#include "tensorflow/compiler/plugin/executor/platform_id.h" - -#include "tensorflow/compiler/xla/status_macros.h" #include #include -namespace se = ::perftools::gputools; +#include "tensorflow/compiler/plugin/executor/platform_id.h" +#include "tensorflow/compiler/xla/status_macros.h" namespace perftools { namespace gputools { @@ -37,10 +35,7 @@ ExecutorExecutor::ExecutorExecutor(const PluginConfig &plugin_config) ExecutorExecutor::~ExecutorExecutor() {} -void *ExecutorExecutor::Allocate(uint64 size) { - void *buf = new char[size]; - return buf; -} +void *ExecutorExecutor::Allocate(uint64 size) { return new char[size]; } void *ExecutorExecutor::AllocateSubBuffer(DeviceMemoryBase *parent, uint64 offset_bytes, @@ -126,8 +121,7 @@ DeviceDescription *ExecutorExecutor::PopulateDeviceDescription() const { builder.set_device_memory_size(static_cast(4) * 1024 * 1024 * 1024); builder.set_clock_rate_ghz(static_cast(CLOCKS_PER_SEC) / 1e9); - auto built = builder.Build(); - return built.release(); + return builder.Build().release(); } } // namespace executorplugin diff --git a/tensorflow/compiler/xla/service/hlo_rematerialization_test.cc b/tensorflow/compiler/xla/service/hlo_rematerialization_test.cc index 1a861cd16b9..3a935dcf968 100644 --- a/tensorflow/compiler/xla/service/hlo_rematerialization_test.cc +++ b/tensorflow/compiler/xla/service/hlo_rematerialization_test.cc @@ -357,7 +357,7 @@ TEST_F(HloRematerializationTest, InstructionRematerializedMultipleTimes) { /*dimension=*/0)); builder.AddInstruction(HloInstruction::CreateSlice( vec1024_shape_, concat, /*start_indices=*/{0}, - /*limit_indices=*/{1024}, /*slices=*/{1})); + /*limit_indices=*/{1024}, /*strides=*/{1})); subcomputation = module->AddEmbeddedComputation(builder.Build()); } @@ -473,7 +473,7 @@ TEST_P(IndirectUseTest, IndirectUseNotRematerialized) { /*dimension=*/0)); builder.AddInstruction(HloInstruction::CreateSlice( vec1024_shape_, concat, /*start_indices=*/{0}, - /*limit_indices=*/{1024}, /*slices=*/{1})); + /*limit_indices=*/{1024}, /*strides=*/{1})); subcomputation = module->AddEmbeddedComputation(builder.Build()); } diff --git a/tensorflow/contrib/boosted_trees/kernels/ensemble_optimizer_ops.cc b/tensorflow/contrib/boosted_trees/kernels/ensemble_optimizer_ops.cc index a6b7a050c85..5cde2290105 100644 --- a/tensorflow/contrib/boosted_trees/kernels/ensemble_optimizer_ops.cc +++ b/tensorflow/contrib/boosted_trees/kernels/ensemble_optimizer_ops.cc @@ -19,7 +19,6 @@ #include "tensorflow/contrib/boosted_trees/proto/tree_config.pb.h" #include "tensorflow/contrib/boosted_trees/resources/decision_tree_ensemble_resource.h" #include "tensorflow/core/framework/op_kernel.h" -#include "tensorflow/core/framework/resource_handle.pb.h" #include "tensorflow/core/framework/resource_mgr.h" #include "tensorflow/core/framework/tensor.h" #include "tensorflow/core/framework/tensor_shape.h" diff --git a/tensorflow/contrib/boosted_trees/kernels/model_ops.cc b/tensorflow/contrib/boosted_trees/kernels/model_ops.cc index 6f553df6d7c..42112c586a5 100644 --- a/tensorflow/contrib/boosted_trees/kernels/model_ops.cc +++ b/tensorflow/contrib/boosted_trees/kernels/model_ops.cc @@ -18,7 +18,6 @@ #include "tensorflow/contrib/boosted_trees/proto/tree_config.pb.h" #include "tensorflow/contrib/boosted_trees/resources/decision_tree_ensemble_resource.h" #include "tensorflow/core/framework/op_kernel.h" -#include "tensorflow/core/framework/resource_handle.pb.h" #include "tensorflow/core/framework/resource_mgr.h" #include "tensorflow/core/framework/tensor.h" #include "tensorflow/core/framework/tensor_shape.h" diff --git a/tensorflow/contrib/tensor_forest/kernels/model_ops.cc b/tensorflow/contrib/tensor_forest/kernels/model_ops.cc index ac8ec68d807..5b265a869db 100644 --- a/tensorflow/contrib/tensor_forest/kernels/model_ops.cc +++ b/tensorflow/contrib/tensor_forest/kernels/model_ops.cc @@ -19,7 +19,6 @@ #include "tensorflow/contrib/tensor_forest/kernels/v4/input_data.h" #include "tensorflow/contrib/tensor_forest/proto/tensor_forest_params.pb.h" #include "tensorflow/core/framework/op_kernel.h" -#include "tensorflow/core/framework/resource_handle.pb.h" #include "tensorflow/core/framework/resource_mgr.h" #include "tensorflow/core/framework/tensor.h" #include "tensorflow/core/framework/tensor_shape.h" diff --git a/tensorflow/contrib/tensor_forest/kernels/stats_ops.cc b/tensorflow/contrib/tensor_forest/kernels/stats_ops.cc index e3d8aa89d68..c80802e97bc 100644 --- a/tensorflow/contrib/tensor_forest/kernels/stats_ops.cc +++ b/tensorflow/contrib/tensor_forest/kernels/stats_ops.cc @@ -22,7 +22,6 @@ #include "tensorflow/contrib/tensor_forest/kernels/v4/params.h" #include "tensorflow/contrib/tensor_forest/proto/fertile_stats.pb.h" #include "tensorflow/core/framework/op_kernel.h" -#include "tensorflow/core/framework/resource_handle.pb.h" #include "tensorflow/core/framework/resource_mgr.h" #include "tensorflow/core/framework/tensor.h" #include "tensorflow/core/framework/tensor_shape.h" diff --git a/tensorflow/core/ops/state_ops.cc b/tensorflow/core/ops/state_ops.cc index 1c9ae90a26f..aaab790d023 100644 --- a/tensorflow/core/ops/state_ops.cc +++ b/tensorflow/core/ops/state_ops.cc @@ -18,7 +18,6 @@ limitations under the License. namespace tensorflow { -using shape_inference::DimensionHandle; using shape_inference::InferenceContext; using shape_inference::ShapeHandle; diff --git a/tensorflow/python/framework/test_ops.cc b/tensorflow/python/framework/test_ops.cc index 275f9bec25a..d22b5b3e25b 100644 --- a/tensorflow/python/framework/test_ops.cc +++ b/tensorflow/python/framework/test_ops.cc @@ -16,7 +16,6 @@ limitations under the License. #include "tensorflow/core/framework/common_shape_fns.h" #include "tensorflow/core/framework/op.h" #include "tensorflow/core/framework/op_kernel.h" -#include "tensorflow/core/framework/resource_handle.pb.h" #include "tensorflow/core/framework/resource_mgr.h" #include "tensorflow/core/lib/core/status.h" #include "tensorflow/core/public/version.h"