Compute Library
 21.02
FusedDepthwiseConvolutionBatchNormalizationNode.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2019 Arm Limited.
3  *
4  * SPDX-License-Identifier: MIT
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a copy
7  * of this software and associated documentation files (the "Software"), to
8  * deal in the Software without restriction, including without limitation the
9  * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10  * sell copies of the Software, and to permit persons to whom the Software is
11  * furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included in all
14  * copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22  * SOFTWARE.
23  */
24 #ifndef ARM_COMPUTE_GRAPH_FUSED_DEPTHWISE_CONVOLUTION_BATCH_NORMALIZATION_NODE_H
25 #define ARM_COMPUTE_GRAPH_FUSED_DEPTHWISE_CONVOLUTION_BATCH_NORMALIZATION_NODE_H
26 
28 
29 namespace arm_compute
30 {
31 namespace graph
32 {
33 /** Fused Depthwise Convolution Batch Normalization node */
35 {
36 public:
37  /** Constructor
38  *
39  * @param[in] epsilon Epsilon parameter.
40  * @param[in] info Convolution layer attributes.
41  * @param[in] depth_multiplier (Optional) Multiplier to apply to the input's depth in order to retrieve the output's depth. Defaults to 1.
42  * @param[in] method (Optional) Convolution method to use
43  * @param[in] fused_activation (Optional) Fused activation layer. Disabled if not specified
44  */
47  unsigned int depth_multiplier,
50 
51  /** Sets the depthwise convolution layer method to use
52  *
53  * @param[in] method Method to use for depthwise convolution
54  */
56 
57  /** Depthwise convolution layer method accessor
58  *
59  * @note This is an indication on which depthwise convolution layer implementation to use,
60  * if it fails to be created the library's heuristic approach will be used
61  *
62  * @return Depthwise convolution layer method to be used by the node
63  */
65 
66  /** Epsilon parameter accessor
67  *
68  * @return Epsilon parameter
69  */
70  float epsilon() const;
71 
72  /** Returns fused activation
73  *
74  * @return Fused activation
75  */
77 
78  /** Sets fused activation
79  *
80  * @param[in] fused_activation Fused activation to set
81  */
82  void set_fused_activation(ActivationLayerInfo fused_activation);
83 
84  /** Computes convolution output descriptor
85  *
86  * @param[in] input_descriptor Input descriptor
87  * @param[in] weights_descriptor Weights descriptor
88  * @param[in] info Convolution operation attributes
89  * @param[in] depth_multiplier Depth multiplier
90  *
91  * @return Output descriptor
92  */
93  static TensorDescriptor compute_output_descriptor(const TensorDescriptor &input_descriptor,
94  const TensorDescriptor &weights_descriptor,
95  const PadStrideInfo &info,
96  int depth_multiplier);
97 
98  /** Sets the convolution layer method to use
99  *
100  * @param[in] method Method to use for convolution
101  */
103 
104  /** Depth multiplier accessor
105  *
106  * @return Depth multiplier
107  */
108  unsigned int depth_multiplier() const;
109 
110  /** Convolution metadata accessor
111  *
112  * @return Convolution information
113  */
115 
116  // Inherited overridden methods:
117  NodeType type() const override;
118  bool forward_descriptors() override;
119  TensorDescriptor configure_output(size_t idx) const override;
120  void accept(INodeVisitor &v) override;
121 
122 public:
124 
125 private:
126  float _epsilon;
127 
128  PadStrideInfo _info;
129  unsigned int _depth_multiplier;
131  ActivationLayerInfo _fused_activation;
132 };
133 
134 } // namespace graph
135 } // namespace arm_compute
136 #endif /* ARM_COMPUTE_GRAPH_FUSED_DEPTHWISE_CONVOLUTION_BATCH_NORMALIZATION_NODE_H */
TensorDescriptor configure_output(size_t idx) const override
Calculates output configuration.
void set_convolution_method(ConvolutionMethod method)
Sets the convolution layer method to use.
DepthwiseConvolutionMethod depthwise_convolution_method() const
Depthwise convolution layer method accessor.
void set_depthwise_convolution_method(DepthwiseConvolutionMethod method)
Sets the depthwise convolution layer method to use.
Activation Layer Information class.
Definition: Types.h:1550
FusedDepthwiseConvolutionBatchNormalizationNode(float epsilon, PadStrideInfo info, unsigned int depth_multiplier, DepthwiseConvolutionMethod method, ActivationLayerInfo fused_activation=ActivationLayerInfo())
Constructor.
Copyright (c) 2017-2021 Arm Limited.
void set_fused_activation(ActivationLayerInfo fused_activation)
Sets fused activation.
Node interface.
Definition: INode.h:45
DepthwiseConvolutionMethod
Supported Depthwise Convolution layer methods.
Definition: Types.h:127
static TensorDescriptor compute_output_descriptor(const TensorDescriptor &input_descriptor, const TensorDescriptor &weights_descriptor, const PadStrideInfo &info, int depth_multiplier)
Computes convolution output descriptor.
NodeType
Supported nodes.
Definition: Types.h:142
Padding and stride information class.
Definition: Types.h:722
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)
ConvolutionMethod
Supported Convolution layer methods.
Definition: Types.h:118
Node visitor interface.
Definition: INodeVisitor.h:34
bool forward_descriptors() override
Forwards descriptor information to outputs if possible.