aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/compiler/xla/service/convolution_feature_group_converter.h
diff options
context:
space:
mode:
authorGravatar Adrian Kuegel <akuegel@google.com>2018-08-16 02:18:48 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-08-16 02:22:18 -0700
commit3f08f82a7c896d357262a47eda8df80b778a2672 (patch)
treeb34f6644ec1be83f9b77f63d4858f5bbc3068ee0 /tensorflow/compiler/xla/service/convolution_feature_group_converter.h
parentb7f74b43aabd2953c06fd9aa40f8f6e2d62b7e6a (diff)
Add a HloPass to rewrite convolutions with feature_group_count > 1.
The convolutions are rewritten to convolutions with feature_group_count = 1. Adapt hlo_verifier and shape_inference to handle feature_group_count > 1. Add the new pass to the backends, and write a depthwise convolution test. PiperOrigin-RevId: 208954204
Diffstat (limited to 'tensorflow/compiler/xla/service/convolution_feature_group_converter.h')
-rw-r--r--tensorflow/compiler/xla/service/convolution_feature_group_converter.h43
1 files changed, 43 insertions, 0 deletions
diff --git a/tensorflow/compiler/xla/service/convolution_feature_group_converter.h b/tensorflow/compiler/xla/service/convolution_feature_group_converter.h
new file mode 100644
index 0000000000..f213cc8709
--- /dev/null
+++ b/tensorflow/compiler/xla/service/convolution_feature_group_converter.h
@@ -0,0 +1,43 @@
+/* Copyright 2018 The TensorFlow Authors. All Rights Reserved.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+==============================================================================*/
+
+#ifndef TENSORFLOW_COMPILER_XLA_SERVICE_CONVOLUTION_FEATURE_GROUP_CONVERTER_H_
+#define TENSORFLOW_COMPILER_XLA_SERVICE_CONVOLUTION_FEATURE_GROUP_CONVERTER_H_
+
+#include "tensorflow/compiler/xla/service/hlo_module.h"
+#include "tensorflow/compiler/xla/service/hlo_pass_interface.h"
+#include "tensorflow/compiler/xla/status_macros.h"
+#include "tensorflow/core/lib/core/stringpiece.h"
+
+namespace xla {
+
+// A pass which rewrites convolutions with feature_group_count > 1 into
+// convolutions with feature_group_count = 1.
+class ConvolutionFeatureGroupConverter : public HloPassInterface {
+ public:
+ ConvolutionFeatureGroupConverter() {}
+
+ tensorflow::StringPiece name() const override {
+ return "convolution-feature-group-converter";
+ }
+
+ // Run convolution rewriting on the given computation. Returns whether the
+ // computation was changed.
+ StatusOr<bool> Run(HloModule* module) override;
+};
+
+} // namespace xla
+
+#endif // TENSORFLOW_COMPILER_XLA_SERVICE_CONVOLUTION_FEATURE_GROUP_CONVERTER_H_