• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* Copyright 2017 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_COMPILER_TF2XLA_FUNCTIONALIZE_WHILE_H_
17 #define TENSORFLOW_COMPILER_TF2XLA_FUNCTIONALIZE_WHILE_H_
18 
19 #include "tensorflow/compiler/tf2xla/functionalize_control_flow_util.h"
20 #include "tensorflow/core/framework/function.h"
21 #include "tensorflow/core/graph/graph.h"
22 
23 namespace tensorflow {
24 
25 // Transformation that converts tf.while_loop() loops into functional While
26 // operators, suitable for XLA compilation. If lookup_library is provided, use
27 // it to make the library for control flow self-contained.
28 //
29 // If `node_filter` is defined, then only loops for whose nodes `node_filter`
30 // returns true are functionalized.
31 //
32 // Preconditions:
33 // Same as for `FunctionalizeControlFlow` (see comment there).
34 Status FunctionalizeWhileLoop(Graph* graph, FunctionLibraryDefinition* library,
35                               const NodeFilter& node_filter = {});
36 
37 }  // namespace tensorflow
38 
39 #endif  // TENSORFLOW_COMPILER_TF2XLA_FUNCTIONALIZE_WHILE_H_
40