tf_1.8_xla_doc
batchnorm_expander.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_BATCHNORM_EXPANDER_H_
15 #define TENSORFLOW_COMPILER_XLA_SERVICE_BATCHNORM_EXPANDER_H_
16 #include <utility>
18 #include "tensorflow/compiler/xla/service/hlo_pass_interface.h"
19 namespace xla {
28 class BatchNormExpander : public HloPassInterface {
29  public:
30  // When use_fusion is set, a multi-output fusion node is created.
31  BatchNormExpander(bool rewrite_training_op = false,
32  bool rewrite_inference_op = false,
33  bool rewrite_grad_op = false, bool use_fusion = true)
34  : rewrite_training_op_(rewrite_training_op),
35  rewrite_inference_op_(rewrite_inference_op),
36  rewrite_grad_op_(rewrite_grad_op),
37  use_fusion_(use_fusion) {}
38  ~BatchNormExpander() = default;
39  tensorflow::StringPiece name() const override { return "batchnorm_expander"; }
40  // Run operation expander on the given computation. Returns whether the
41  // computation was changed.
42  StatusOr<bool> Run(HloModule* module) override;
43  private:
44  bool rewrite_training_op_;
45  bool rewrite_inference_op_;
46  bool rewrite_grad_op_;
47  bool use_fusion_;
48 };
49 } // namespace xla
50 #endif // TENSORFLOW_COMPILER_XLA_SERVICE_BATCHNORM_EXPANDER_H_
51 
Definition: batchnorm_expander.h:28
namespace for xla
Definition: client_library.cc:26
Definition: hlo_module.h:52