diff options
Diffstat (limited to 'tensorflow')
5 files changed, 0 insertions, 187 deletions
diff --git a/tensorflow/contrib/data/python/kernel_tests/optimize_dataset_op_test.py b/tensorflow/contrib/data/python/kernel_tests/optimize_dataset_op_test.py index ca38f8e2f9..ec43bc3653 100644 --- a/tensorflow/contrib/data/python/kernel_tests/optimize_dataset_op_test.py +++ b/tensorflow/contrib/data/python/kernel_tests/optimize_dataset_op_test.py @@ -100,20 +100,6 @@ class OptimizeDatasetTest(test.TestCase, parameterized.TestCase): with self.assertRaises(errors.OutOfRangeError): sess.run(get_next) - # TODO(b/112914454): Remove the test or figure out way to copy only new - # functions in optimize_dataset_op instead of taking union of old and new - # functions. - def _testFunctionLibraryDefinitionModification(self): - dataset = dataset_ops.Dataset.from_tensors(0).map(lambda x: x).apply( - optimization.optimize(["_test_only_function_rename"])) - iterator = dataset.make_one_shot_iterator() - get_next = iterator.get_next() - - with self.test_session() as sess: - with self.assertRaisesRegexp(errors.NotFoundError, - "Function .* is not defined."): - sess.run(get_next) - if __name__ == "__main__": test.main() diff --git a/tensorflow/core/grappler/optimizers/data/BUILD b/tensorflow/core/grappler/optimizers/data/BUILD index 979c437c02..530c957068 100644 --- a/tensorflow/core/grappler/optimizers/data/BUILD +++ b/tensorflow/core/grappler/optimizers/data/BUILD @@ -42,39 +42,6 @@ tf_cc_test( ) cc_library( - name = "function_rename", - srcs = ["function_rename.cc"], - hdrs = [ - "function_rename.h", - ], - visibility = ["//visibility:public"], - deps = [ - ":graph_utils", - "//tensorflow/core:lib", - "//tensorflow/core/grappler:graph_view", - "//tensorflow/core/grappler:grappler_item", - "//tensorflow/core/grappler:op_types", - "//tensorflow/core/grappler:utils", - "//tensorflow/core/grappler/clusters:cluster", - "//tensorflow/core/grappler/optimizers:custom_graph_optimizer", - "//tensorflow/core/grappler/optimizers:custom_graph_optimizer_registry", - ] + tf_protos_all(), -) - -tf_cc_test( - name = "function_rename_test", - srcs = ["function_rename_test.cc"], - visibility = ["//visibility:public"], - deps = [ - ":function_rename", - "//tensorflow/core:framework", - "//tensorflow/core:test", - "//tensorflow/core:test_main", - "//tensorflow/core/grappler:grappler_item", - ] + tf_protos_all(), -) - -cc_library( name = "fusion_utils", srcs = ["fusion_utils.cc"], hdrs = [ @@ -384,7 +351,6 @@ cc_library( visibility = ["//visibility:public"], deps = [ ":filter_fusion", - ":function_rename", ":latency_all_edges", ":map_and_batch_fusion", ":map_and_filter_fusion", diff --git a/tensorflow/core/grappler/optimizers/data/function_rename.cc b/tensorflow/core/grappler/optimizers/data/function_rename.cc deleted file mode 100644 index 8cf044d1bd..0000000000 --- a/tensorflow/core/grappler/optimizers/data/function_rename.cc +++ /dev/null @@ -1,51 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -==============================================================================*/ - -#include "tensorflow/core/grappler/optimizers/data/function_rename.h" - -#include "tensorflow/core/grappler/clusters/cluster.h" -#include "tensorflow/core/grappler/graph_view.h" -#include "tensorflow/core/grappler/grappler_item.h" -#include "tensorflow/core/grappler/op_types.h" -#include "tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.h" -#include "tensorflow/core/grappler/optimizers/data/graph_utils.h" -#include "tensorflow/core/grappler/utils.h" -#include "tensorflow/core/platform/protobuf.h" - -namespace tensorflow { -namespace grappler { - -Status FunctionRename::Optimize(Cluster* cluster, const GrapplerItem& item, - GraphDef* output) { - *output = item.graph; - GraphView graph(output); - int n = output->mutable_library()->function_size(); - for (int i = 0; i < n; ++i) { - FunctionDef* fn = output->mutable_library()->mutable_function(i); - fn->mutable_signature()->set_name(fn->signature().name() + "world"); - } - - return Status::OK(); -} - -void FunctionRename::Feedback(Cluster* cluster, const GrapplerItem& item, - const GraphDef& optimize_output, double result) { - // no-op -} - -REGISTER_GRAPH_OPTIMIZER_AS(FunctionRename, "_test_only_function_rename"); - -} // end namespace grappler -} // end namespace tensorflow diff --git a/tensorflow/core/grappler/optimizers/data/function_rename.h b/tensorflow/core/grappler/optimizers/data/function_rename.h deleted file mode 100644 index 23ad9470ff..0000000000 --- a/tensorflow/core/grappler/optimizers/data/function_rename.h +++ /dev/null @@ -1,46 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -==============================================================================*/ - -#ifndef TENSORFLOW_CORE_GRAPPLER_OPTIMIZERS_DATA_FUNCTION_RENAME_H_ -#define TENSORFLOW_CORE_GRAPPLER_OPTIMIZERS_DATA_FUNCTION_RENAME_H_ - -#include "tensorflow/core/grappler/optimizers/custom_graph_optimizer.h" - -namespace tensorflow { -namespace grappler { - -class FunctionRename : public CustomGraphOptimizer { - public: - FunctionRename() = default; - ~FunctionRename() override = default; - - string name() const override { return "_test_only_function_rename"; }; - - Status Init( - const tensorflow::RewriterConfig_CustomGraphOptimizer* config) override { - return Status::OK(); - } - - Status Optimize(Cluster* cluster, const GrapplerItem& item, - GraphDef* output) override; - - void Feedback(Cluster* cluster, const GrapplerItem& item, - const GraphDef& optimize_output, double result) override; -}; - -} // end namespace grappler -} // end namespace tensorflow - -#endif // TENSORFLOW_CORE_GRAPPLER_OPTIMIZERS_DATA_FUNCTION_RENAME_H_ diff --git a/tensorflow/core/grappler/optimizers/data/function_rename_test.cc b/tensorflow/core/grappler/optimizers/data/function_rename_test.cc deleted file mode 100644 index 56b8a960a7..0000000000 --- a/tensorflow/core/grappler/optimizers/data/function_rename_test.cc +++ /dev/null @@ -1,42 +0,0 @@ -/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -==============================================================================*/ - -#include "tensorflow/core/grappler/optimizers/data/function_rename.h" - -#include "tensorflow/core/framework/function.pb.h" -#include "tensorflow/core/framework/op_def.pb.h" -#include "tensorflow/core/grappler/grappler_item.h" -#include "tensorflow/core/lib/core/status_test_util.h" -#include "tensorflow/core/platform/test.h" - -namespace tensorflow { -namespace grappler { -namespace { - -TEST(FunctionRenameTest, RenameFunction) { - GrapplerItem item; - GraphDef *graph = &item.graph; - FunctionDef *fn = graph->mutable_library()->add_function(); - fn->mutable_signature()->set_name("hello"); - - FunctionRename optimizer; - GraphDef output; - TF_ASSERT_OK(optimizer.Optimize(nullptr, item, &output)); - EXPECT_EQ(output.library().function(0).signature().name(), "helloworld"); -} - -} // namespace -} // namespace grappler -} // namespace tensorflow |