Home | History | Annotate | Download | only in utils
      1 /* Copyright 2018 The TensorFlow Authors. All Rights Reserved.
      2 
      3 Licensed under the Apache License, Version 2.0 (the "License");
      4 you may not use this file except in compliance with the License.
      5 You may obtain a copy of the License at
      6 
      7     http://www.apache.org/licenses/LICENSE-2.0
      8 
      9 Unless required by applicable law or agreed to in writing, software
     10 distributed under the License is distributed on an "AS IS" BASIS,
     11 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     12 See the License for the specific language governing permissions and
     13 limitations under the License.
     14 ==============================================================================*/
     15 
     16 #include "tensorflow/core/grappler/utils/grappler_test.h"
     17 #include <memory>
     18 #include "tensorflow/core/grappler/utils.h"
     19 #include "tensorflow/core/lib/core/status.h"
     20 #include "tensorflow/core/public/session.h"
     21 
     22 namespace tensorflow {
     23 namespace grappler {
     24 
     25 std::vector<Tensor> GrapplerTest::EvaluateNodes(
     26     const GraphDef& graph, const std::vector<string>& node_names) {
     27   SessionOptions options;
     28   std::unique_ptr<tensorflow::Session> session(NewSession(options));
     29   TF_CHECK_OK(session->Create(graph));
     30   RunOptions run_options;
     31   std::vector<Tensor> output_tensors;
     32   TF_CHECK_OK(session->Run(run_options, {}, node_names, node_names,
     33                            &output_tensors, nullptr));
     34   TF_CHECK_OK(session->Close());
     35   return output_tensors;
     36 }
     37 
     38 }  // namespace grappler
     39 }  // namespace tensorflow
     40