diff options
Diffstat (limited to 'tensorflow/core/grappler/optimizers/data/function_rename_test.cc')
-rw-r--r-- | tensorflow/core/grappler/optimizers/data/function_rename_test.cc | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/tensorflow/core/grappler/optimizers/data/function_rename_test.cc b/tensorflow/core/grappler/optimizers/data/function_rename_test.cc new file mode 100644 index 0000000000..56b8a960a7 --- /dev/null +++ b/tensorflow/core/grappler/optimizers/data/function_rename_test.cc @@ -0,0 +1,42 @@ +/* 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 |