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 #ifndef TENSORFLOW_CORE_API_DEF_UPDATE_API_DEF_H_
16 #define TENSORFLOW_CORE_API_DEF_UPDATE_API_DEF_H_
17 // Functions for updating ApiDef when new ops are added.
18 
19 #include "tensorflow/core/framework/op_def.pb.h"
20 #include "tensorflow/core/platform/types.h"
21 
22 namespace tensorflow {
23 
24 // Returns ApiDefs text representation in multi-line format
25 // constructed based on the given op.
26 string CreateApiDef(const OpDef& op);
27 
28 // Removes .Doc call for the given op.
29 // If unsuccessful, returns original file_contents and prints an error.
30 // start_location - We search for .Doc call starting at this location
31 //   in file_contents.
32 string RemoveDoc(const OpDef& op, const string& file_contents,
33                  size_t start_location);
34 
35 // Creates api_def_*.pbtxt files for any new ops (i.e. ops that don't have an
36 // api_def_*.pbtxt file yet).
37 // If op_file_pattern is non-empty, then this method will also
38 // look for a REGISTER_OP call for the new ops and removes corresponding
39 // .Doc() calls since the newly generated api_def_*.pbtxt files will
40 // store the doc strings.
41 void CreateApiDefs(const OpList& ops, const string& api_def_dir,
42                    const string& op_file_pattern);
43 
44 }  // namespace tensorflow
45 #endif  // TENSORFLOW_CORE_API_DEF_UPDATE_API_DEF_H_
46