tf_1.8_xla_doc
hlo_pass_fix.h
Go to the documentation of this file.
1 
3 /* Copyright 2017 The TensorFlow Authors. All Rights Reserved.
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
7  http://www.apache.org/licenses/LICENSE-2.0
8 Unless required by applicable law or agreed to in writing, software
9 distributed under the License is distributed on an "AS IS" BASIS,
10 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 See the License for the specific language governing permissions and
12 limitations under the License.
13 ==============================================================================*/
14 #ifndef TENSORFLOW_COMPILER_XLA_SERVICE_HLO_PASS_FIX_H_
15 #define TENSORFLOW_COMPILER_XLA_SERVICE_HLO_PASS_FIX_H_
17 #include "tensorflow/compiler/xla/status_macros.h"
18 #include "tensorflow/compiler/xla/statusor.h"
19 #include "tensorflow/compiler/xla/types.h"
20 #include "tensorflow/core/platform/macros.h"
21 namespace xla {
26 template <typename Pass>
27 class HloPassFix : public Pass {
28  public:
29  template <typename... Args>
30  explicit HloPassFix(Args&&... args) : Pass(args...) {}
31  StatusOr<bool> Run(HloModule* module) override {
32  bool changed = false;
33  bool changed_this_iteration = true;
34  while (changed_this_iteration) {
35  TF_ASSIGN_OR_RETURN(changed_this_iteration, Pass::Run(module));
36  changed |= changed_this_iteration;
37  }
38  return changed;
39  }
40 };
41 } // namespace xla
42 #endif // TENSORFLOW_COMPILER_XLA_SERVICE_HLO_PASS_FIX_H_
43 
namespace for xla
Definition: client_library.cc:26
Definition: hlo_pass_fix.h:27
Definition: hlo_module.h:52