• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* Copyright 2019 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_CORE_GRAPPLER_VERIFIERS_GRAPH_VERIFIER_H_
17 #define TENSORFLOW_CORE_GRAPPLER_VERIFIERS_GRAPH_VERIFIER_H_
18 
19 #include <string>
20 #include <vector>
21 #include "tensorflow/core/framework/graph.pb.h"
22 #include "tensorflow/core/lib/core/status.h"
23 
24 namespace tensorflow {
25 namespace grappler {
26 
27 // An abstract interface for verifying a graph.
28 // This will be used to implement specific verifiers to verify that a grappler
29 // transformed graph is valid.
30 // Some examples of specific verifiers are:
31 // 1. A general structural verifier that verifies that the specified graph has
32 //    a valid structure that meets the specification of what it means to be
33 //      a valid TensorFlow graph.
34 // 2. A backend specific verifier that verifies that the specified graph,
35 //     generated after a grappler transformation to convert the input TensorFlow
36 //     graph to a corresponding backend graph, is a valid graph in the
37 //     specification of the backend.
38 class GraphVerifier {
39  public:
GraphVerifier()40   GraphVerifier() {}
~GraphVerifier()41   virtual ~GraphVerifier() {}
42 
43   // A name for the verifier.
44   virtual string name() const = 0;
45 
46   // Implement an algorithm to verify the specified graph.
47   // The return value is a Status that represents a concatenation of Status of
48   // each verification step.
49   virtual Status Verify(const GraphDef& graph) = 0;
50 };
51 
52 }  // end namespace grappler
53 }  // end namespace tensorflow
54 
55 #endif  // TENSORFLOW_CORE_GRAPPLER_VERIFIERS_GRAPH_VERIFIER_H_
56