Publishing 2019 R1 content
[platform/upstream/dldt.git] / inference-engine / src / mkldnn_plugin / mkldnn_graph_optimizer.h
1 // Copyright (C) 2018-2019 Intel Corporation
2 // SPDX-License-Identifier: Apache-2.0
3 //
4
5 #pragma once
6
7 #include "mkldnn_graph.h"
8 #include <vector>
9
10 namespace MKLDNNPlugin {
11
12 class MKLDNNGraphOptimizer {
13 public:
14     MKLDNNGraphOptimizer();
15
16 public:
17     void ApplyCommonGraphOptimizations(MKLDNNGraph& graph);
18     void ApplyImplSpecificGraphOptimizations(MKLDNNGraph& graph);
19
20 private:
21     void SLTMTransform(MKLDNNGraph& graph);
22     void MergeGroupConvolution(MKLDNNGraph& graph);
23     void FuseConvolutionAndActivation(MKLDNNGraph &graph);
24     void FuseConvolutionAndDepthwise(MKLDNNGraph &graph);
25     void FuseConvolutionAndDWConvolution(MKLDNNGraph &graph);
26     void FuseBinaryConvolutionAndQuantize(MKLDNNGraph &graph);
27     void FuseBatchNormWithScale(MKLDNNGraph& graph);
28     void FuseConvolutionSumAndConvolutionSumActivation(MKLDNNGraph &graph);
29     void FuseFullyConnectedAndActivation(MKLDNNGraph &graph);
30     void RemoveIdentityOperator(MKLDNNGraph& graph);
31
32     void RemoveIOScaleShifts(MKLDNNGraph& graph);
33     void DropDoubleReorders(MKLDNNGraph& graph);
34
35     void AddScaleShiftAfterInt8(MKLDNNGraph &graph);
36
37
38     bool IsOneOf(Type type, std::vector<Type> types);
39 };
40
41 }  // namespace MKLDNNPlugin