Compute Library
 21.11
AssemblyUtils.cpp
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  */
25 
26 namespace arm_compute
27 {
28 namespace assembly_utils
29 {
31 {
32  arm_gemm::Activation gemm_act;
33 
34  // Early exit in case lower bound is other than 0, as it's not yet supported
35  if(act.b() != 0.f)
36  {
37  return gemm_act;
38  }
39 
40  switch(act.activation())
41  {
44  break;
47  gemm_act.param1 = act.a();
48  gemm_act.param2 = 0.f;
49  break;
52  gemm_act.param1 = act.a();
53  gemm_act.param2 = act.b();
54  break;
55  default:
57  }
58 
59  return gemm_act;
60 }
61 
62 arm_conv::PaddingValues map_to_arm_conv_padding(const PadStrideInfo &pad_stride_info)
63 {
64  return arm_conv::PaddingValues{ pad_stride_info.pad_left(),
65  pad_stride_info.pad_top(),
66  pad_stride_info.pad_right(),
67  pad_stride_info.pad_bottom() };
68 }
69 } // namespace assembly_utils
70 } // namespace arm_compute
float a() const
Get the alpha value.
Definition: Types.h:1549
unsigned int pad_top() const
Get the top padding.
Definition: Types.h:740
Activation Layer Information class.
Definition: Types.h:1509
Copyright (c) 2017-2021 Arm Limited.
unsigned int pad_right() const
Get the right padding.
Definition: Types.h:735
Padding and stride information class.
Definition: Types.h:656
ActivationFunction activation() const
Get the type of activation function.
Definition: Types.h:1544
float b() const
Get the beta value.
Definition: Types.h:1554
arm_gemm::Activation map_to_arm_gemm_activation(const ActivationLayerInfo &act)
Performs a mapping between Compute Library ActivationLayerInfo and the assembly Activation structure...
unsigned int pad_bottom() const
Get the bottom padding.
Definition: Types.h:745
arm_conv::PaddingValues map_to_arm_conv_padding(const PadStrideInfo &pad_stride_info)
Performs a mapping between Compute Library PadStrideInfo and the assembly PaddingValues structure...
unsigned int pad_left() const
Get the left padding.
Definition: Types.h:730