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 #ifndef TENSORFLOW_LITE_TOOLS_ACCURACY_STAGE_H_ 17 #define TENSORFLOW_LITE_TOOLS_ACCURACY_STAGE_H_ 18 19 #include "tensorflow/cc/framework/scope.h" 20 21 namespace tensorflow { 22 namespace metrics { 23 24 // A stage in an evaluation pipeline. 25 // Each stage adds a subgraph to the pipeline. Stages can be chained 26 // together. 27 class Stage { 28 public: 29 Stage() = default; 30 Stage(const Stage&) = delete; 31 Stage& operator=(const Stage&) = delete; 32 33 Stage(const Stage&&) = delete; 34 Stage& operator=(const Stage&&) = delete; 35 36 // Adds a subgraph to given scope that takes in `input` as a parameter. 37 virtual void AddToGraph(const Scope& scope, const Input& input) = 0; ~Stage()38 virtual ~Stage() {} 39 40 // The name of the stage. 41 // Can be used by derived classes for naming the subscope for the stage 42 // graph. 43 virtual string name() const = 0; 44 45 // The name of the output for the stage. 46 virtual string output_name() const = 0; 47 Output()48 const ::tensorflow::Output& Output() const { return stage_output_; } 49 50 protected: 51 ::tensorflow::Output stage_output_; 52 }; 53 } // namespace metrics 54 } // namespace tensorflow 55 56 #endif // TENSORFLOW_LITE_TOOLS_ACCURACY_STAGE_H_ 57