Compute Library
 22.05
FusedConvolutionBatchNormalizationWithPostOpsNode.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2021 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_CONVOLUTION_BATCH_NORMALIZATION_WITH_POST_OPS_NODE_H
25 #define ARM_COMPUTE_GRAPH_FUSED_CONVOLUTION_BATCH_NORMALIZATION_WITH_POST_OPS_NODE_H
26 
28 
29 namespace arm_compute
30 {
31 namespace graph
32 {
33 /** 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] num_groups (Optional) Number of groups (Defaults to 1)
42  * @param[in] method (Optional) Convolution method to use
43  * @param[in] fast_math_hint (Optional) Fast math hint
44  */
46  unsigned int num_groups = 1,
49 
50  /** Epsilon parameter accessor
51  *
52  * @return Epsilon parameter
53  */
54  float epsilon() const;
55 
56  /** Computes convolution output descriptor
57  *
58  * @param[in] input_descriptor Input descriptor
59  * @param[in] weights_descriptor Weights descriptor
60  * @param[in] info Convolution operation attributes
61  *
62  * @return Output descriptor
63  */
64  static TensorDescriptor compute_output_descriptor(const TensorDescriptor &input_descriptor,
65  const TensorDescriptor &weights_descriptor,
66  const PadStrideInfo &info);
67 
68  /** Sets the convolution layer method to use
69  *
70  * @param[in] method Method to use for convolution
71  */
73 
74  /** Number of groups in convolution accessor
75  *
76  * @return Number of groups in convolution
77  */
78  unsigned int num_groups() const;
79 
80  /** Convolution layer method accessor
81  *
82  * @note This is an indication on which convolution layer implementation to use,
83  * if it fails to be created the library's heuristic approach will be used
84  *
85  * @return Convolution layer method to be used by the node
86  */
88 
89  /** Sets the fast math hint
90  *
91  * @param[in] hint Hint to use for convolution
92  */
94 
95  /** Fast math hint accessor
96  *
97  * @return Fast math hint to be used by the node
98  */
100 
101  /** Convolution metadata accessor
102  *
103  * @return Convolution information
104  */
106 
107  // Inherited overridden methods:
108  NodeType type() const override;
109  bool forward_descriptors() override;
110  TensorDescriptor configure_output(size_t idx) const override;
111  void accept(INodeVisitor &v) override;
112 
113 public:
115 
116 private:
117  float _epsilon;
118 
119  PadStrideInfo _info;
120  unsigned int _num_groups;
121  ConvolutionMethod _method;
122  FastMathHint _fast_math_hint;
123 };
124 
125 } // namespace graph
126 } // namespace arm_compute
127 #endif /* ARM_COMPUTE_GRAPH_BATCH_NORMALIZATION_LAYER_NODE_H */
Copyright (c) 2017-2022 Arm Limited.
Fast math disabled for Convolution layer.
Node interface.
Definition: INode.h:46
static TensorDescriptor compute_output_descriptor(const TensorDescriptor &input_descriptor, const TensorDescriptor &weights_descriptor, const PadStrideInfo &info)
Computes convolution output descriptor.
NodeType
Supported nodes.
Definition: Types.h:199
Padding and stride information class.
Definition: Types.h:669
void accept(INodeVisitor &v) override
Accepts a node visitor.
Batch Normalization node.
FusedConvolutionBatchNormalizationWithPostOpsNode(float epsilon, PadStrideInfo info, unsigned int num_groups=1, ConvolutionMethod method=ConvolutionMethod::Default, FastMathHint fast_math_hint=FastMathHint::Disabled)
Constructor.
void set_convolution_method(ConvolutionMethod method)
Sets the convolution layer method to use.
FastMathHint
Enable or disable fast math for Convolution layer.
Definition: Types.h:143
unsigned int num_groups() const
Number of groups in convolution accessor.
bool forward_descriptors() override
Forwards descriptor information to outputs if possible.
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)
TensorDescriptor configure_output(size_t idx) const override
Calculates output configuration.
PadStrideInfo convolution_info() const
Convolution metadata accessor.
FastMathHint fast_math_hint() const
Fast math hint accessor.
ConvolutionMethod
Supported Convolution layer methods.
Definition: Types.h:126
ConvolutionMethod convolution_method() const
Convolution layer method accessor.
void set_fast_math_hint(FastMathHint hint)
Sets the fast math hint.
NodeType type() const override
Returns node's type.
Default approach using internal heuristics.
Node visitor interface.
Definition: INodeVisitor.h:34
float epsilon() const
Epsilon parameter accessor.
static constexpr NodeType node_type