X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=documentation%2Fvalidation_2_g_l_e_s___c_o_m_p_u_t_e_2_convolution_layer_8cpp_source.xhtml;h=8624edbf15771e42db6079e965d335ecf41f350a;hb=06ea048f062a50404b1b3998a61a45449c2d1f0f;hp=a2f4cf2addfe9c573e8c018bb8c56adcbfc45cdf;hpb=292227986edb37b01061afcad6df18ba9d6ccbeb;p=platform%2Fupstream%2Farmcl.git diff --git a/documentation/validation_2_g_l_e_s___c_o_m_p_u_t_e_2_convolution_layer_8cpp_source.xhtml b/documentation/validation_2_g_l_e_s___c_o_m_p_u_t_e_2_convolution_layer_8cpp_source.xhtml index a2f4cf2..8624edb 100644 --- a/documentation/validation_2_g_l_e_s___c_o_m_p_u_t_e_2_convolution_layer_8cpp_source.xhtml +++ b/documentation/validation_2_g_l_e_s___c_o_m_p_u_t_e_2_convolution_layer_8cpp_source.xhtml @@ -40,7 +40,7 @@
Compute Library -  18.01 +  18.02
@@ -117,38 +117,38 @@ $(document).ready(function(){initNavTree('validation_2_g_l_e_s___c_o_m_p_u_t_e_2
ConvolutionLayer.cpp
-Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017-2018 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 CONCLCTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22  * SOFTWARE.
23  */
24 
25 #include "arm_compute/core/Types.h"
34 #include "tests/framework/Macros.h"
38 
39 namespace arm_compute
40 {
41 namespace test
42 {
43 namespace validation
44 {
45 namespace
46 {
47 RelativeTolerance<half_float::half> tolerance_f16(half_float::half(0.2));
48 constexpr float tolerance_num = 0.07f;
51 const auto CNNDataTypes = framework::dataset::make("DataType",
52 {
54  // DataType::F32,
55 });
56 } // namespace
57 
58 TEST_SUITE(GC)
59 TEST_SUITE(ConvolutionLayer)
60 
61 DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(framework::dataset::concat(datasets::SmallConvolutionLayerDataset(), datasets::LargeConvolutionLayerDataset()), CNNDataTypes),
62  input_shape, weights_shape, bias_shape, output_shape, info, data_type)
63 {
64  // Set fixed point position data type allowed
65  int fixed_point_position = is_data_type_fixed_point(data_type) ? 3 : 0;
66 
67  auto bias_data_type = is_data_type_quantized_asymmetric(data_type) ? DataType::S32 : data_type;
68 
69  // Create tensors
70  GCTensor src = create_tensor<GCTensor>(input_shape, data_type, 1, fixed_point_position, QuantizationInfo(2.f / 255.f, 127));
71  GCTensor weights = create_tensor<GCTensor>(weights_shape, data_type, 1, fixed_point_position, QuantizationInfo(2.f / 255.f, 127));
72  GCTensor bias = create_tensor<GCTensor>(bias_shape, bias_data_type, 1, fixed_point_position, QuantizationInfo(2.f / 255.f, 127));
73  GCTensor dst = create_tensor<GCTensor>(output_shape, data_type, 1, fixed_point_position, QuantizationInfo(2.f / 255.f, 127));
74 
75  ARM_COMPUTE_EXPECT(src.info()->is_resizable(), framework::LogLevel::ERRORS);
76  ARM_COMPUTE_EXPECT(weights.info()->is_resizable(), framework::LogLevel::ERRORS);
77  ARM_COMPUTE_EXPECT(bias.info()->is_resizable(), framework::LogLevel::ERRORS);
78  ARM_COMPUTE_EXPECT(dst.info()->is_resizable(), framework::LogLevel::ERRORS);
79 
80  const QuantizationInfo src_quantization_info = src.info()->quantization_info();
81  const QuantizationInfo weights_quantization_info = weights.info()->quantization_info();
82 
83  // Create and configure function
84  GCConvolutionLayer conv;
85  conv.configure(&src, &weights, &bias, &dst, info);
86 
87  // Validate valid region
88  const ValidRegion src_valid_region = shape_to_valid_region(input_shape);
89  const ValidRegion weights_valid_region = shape_to_valid_region(weights_shape);
90  const ValidRegion bias_valid_region = shape_to_valid_region(bias_shape);
91  const ValidRegion dst_valid_region = shape_to_valid_region(output_shape);
92 
93  validate(src.info()->valid_region(), src_valid_region);
94  validate(weights.info()->valid_region(), weights_valid_region);
95  validate(bias.info()->valid_region(), bias_valid_region);
96  validate(dst.info()->valid_region(), dst_valid_region);
97 
98  // Validate QuantizationInfo
99  ARM_COMPUTE_EXPECT(src.info()->quantization_info() == src_quantization_info, framework::LogLevel::ERRORS);
100  ARM_COMPUTE_EXPECT(weights.info()->quantization_info() == weights_quantization_info, framework::LogLevel::ERRORS);
101 
102  //Validate padding
103  //TODO(COMPMID-415) Need to validate padding?
104 }
105 
106 template <typename T>
108 
109 TEST_SUITE(Float)
110 TEST_SUITE(FP16)
111 FIXTURE_DATA_TEST_CASE(RunSmall, GCConvolutionLayerFixture<half>, framework::DatasetMode::PRECOMMIT, combine(combine(datasets::SmallConvolutionLayerDataset(),
112  framework::dataset::make("ReshapeWeights", { true, false })),
113  framework::dataset::make("DataType",
114  DataType::F16)))
115 {
116  // Validate output
117  validate(GCAccessor(_target), _reference, tolerance_f16, tolerance_num);
118 }
120  framework::dataset::make("ReshapeWeights", { true, false })),
121  framework::dataset::make("DataType",
122  DataType::F16)))
123 {
124  // Validate output
125  validate(GCAccessor(_target), _reference, tolerance_f16, tolerance_num);
126 }
128 
131 }
132 } // namespace validation
133 } // namespace test
134 } // namespace arm_compute
+Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017-2018 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 CONCLCTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22  * SOFTWARE.
23  */
24 
25 #include "arm_compute/core/Types.h"
34 #include "tests/framework/Macros.h"
38 
39 namespace arm_compute
40 {
41 namespace test
42 {
43 namespace validation
44 {
45 namespace
46 {
47 RelativeTolerance<half_float::half> tolerance_f16(half_float::half(0.2));
48 constexpr float tolerance_num = 0.07f;
51 const auto CNNDataTypes = framework::dataset::make("DataType",
52 {
54  // DataType::F32,
55 });
56 } // namespace
57 
58 TEST_SUITE(GC)
59 TEST_SUITE(ConvolutionLayer)
60 
61 DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(framework::dataset::concat(datasets::SmallConvolutionLayerDataset(), datasets::LargeConvolutionLayerDataset()), CNNDataTypes),
62  input_shape, weights_shape, bias_shape, output_shape, info, data_type)
63 {
64  // Set fixed point position data type allowed
65  int fixed_point_position = is_data_type_fixed_point(data_type) ? 3 : 0;
66 
67  auto bias_data_type = is_data_type_quantized_asymmetric(data_type) ? DataType::S32 : data_type;
68 
69  // Create tensors
70  GCTensor src = create_tensor<GCTensor>(input_shape, data_type, 1, fixed_point_position, QuantizationInfo(2.f / 255.f, 127));
71  GCTensor weights = create_tensor<GCTensor>(weights_shape, data_type, 1, fixed_point_position, QuantizationInfo(2.f / 255.f, 127));
72  GCTensor bias = create_tensor<GCTensor>(bias_shape, bias_data_type, 1, fixed_point_position, QuantizationInfo(2.f / 255.f, 127));
73  GCTensor dst = create_tensor<GCTensor>(output_shape, data_type, 1, fixed_point_position, QuantizationInfo(2.f / 255.f, 127));
74 
75  ARM_COMPUTE_EXPECT(src.info()->is_resizable(), framework::LogLevel::ERRORS);
76  ARM_COMPUTE_EXPECT(weights.info()->is_resizable(), framework::LogLevel::ERRORS);
77  ARM_COMPUTE_EXPECT(bias.info()->is_resizable(), framework::LogLevel::ERRORS);
78  ARM_COMPUTE_EXPECT(dst.info()->is_resizable(), framework::LogLevel::ERRORS);
79 
80  const QuantizationInfo src_quantization_info = src.info()->quantization_info();
81  const QuantizationInfo weights_quantization_info = weights.info()->quantization_info();
82 
83  // Create and configure function
84  GCConvolutionLayer conv;
85  conv.configure(&src, &weights, &bias, &dst, info);
86 
87  // Validate valid region
88  const ValidRegion src_valid_region = shape_to_valid_region(input_shape);
89  const ValidRegion weights_valid_region = shape_to_valid_region(weights_shape);
90  const ValidRegion bias_valid_region = shape_to_valid_region(bias_shape);
91  const ValidRegion dst_valid_region = shape_to_valid_region(output_shape);
92 
93  validate(src.info()->valid_region(), src_valid_region);
94  validate(weights.info()->valid_region(), weights_valid_region);
95  validate(bias.info()->valid_region(), bias_valid_region);
96  validate(dst.info()->valid_region(), dst_valid_region);
97 
98  // Validate QuantizationInfo
99  ARM_COMPUTE_EXPECT(src.info()->quantization_info() == src_quantization_info, framework::LogLevel::ERRORS);
100  ARM_COMPUTE_EXPECT(weights.info()->quantization_info() == weights_quantization_info, framework::LogLevel::ERRORS);
101 }
102 
103 template <typename T>
105 
106 TEST_SUITE(Float)
107 TEST_SUITE(FP16)
108 FIXTURE_DATA_TEST_CASE(RunSmall, GCConvolutionLayerFixture<half>, framework::DatasetMode::PRECOMMIT, combine(combine(datasets::SmallConvolutionLayerDataset(),
109  framework::dataset::make("ReshapeWeights", { true, false })),
110  framework::dataset::make("DataType",
111  DataType::F16)))
112 {
113  // Validate output
114  validate(GCAccessor(_target), _reference, tolerance_f16, tolerance_num);
115 }
117  framework::dataset::make("ReshapeWeights", { true, false })),
118  framework::dataset::make("DataType",
119  DataType::F16)))
120 {
121  // Validate output
122  validate(GCAccessor(_target), _reference, tolerance_f16, tolerance_num);
123 }
126 
129 } // namespace validation
130 } // namespace test
131 } // namespace arm_compute
Accessor implementation for GCTensor objects.
Definition: GCAccessor.h:35
-
half_float::half half
16-bit floating point type
Definition: Types.h:43
- -
std::enable_if< is_container< T >::value, ContainerDataset< T > >::type make(std::string name, T &&values)
Helper function to create a ContainerDataset.
+
half_float::half half
16-bit floating point type
Definition: Types.h:44
+ +
std::enable_if< is_container< T >::value, ContainerDataset< T > >::type make(std::string name, T &&values)
Helper function to create a ContainerDataset.
src info() -> set_format(Format::S16)
This file contains all available output stages for GEMMLowp on OpenCL.
Definition: 01_library.dox:1
1 channel, 1 F16 per channel
#define TEST_SUITE(SUITE_NAME)
Definition: Macros.h:34
1 channel, 1 S32 per channel
- +
FIXTURE_DATA_TEST_CASE(RunSmall, CLAbsoluteDifferenceFixture< uint8_t >, framework::DatasetMode::PRECOMMIT, combine(datasets::SmallShapes(), AbsoluteDifferenceU8Dataset))
validate(dst.info() ->valid_region(), dst_valid_region)
DatasetMode
Possible dataset modes.
Definition: DatasetModes.h:40
-
combine(combine(combine(concat(datasets::SmallShapes(), datasets::LargeShapes()), framework::dataset::make("DataType", DataType::U8)), datasets::BorderModes()), framework::dataset::make("filter_size",{5}))
-
bool is_data_type_fixed_point(DataType dt)
Check if a given data type is of fixed point type.
Definition: Utils.h:775
- - +
bool is_data_type_fixed_point(DataType dt)
Check if a given data type is of fixed point type.
Definition: Utils.h:1010
+ + -
bool is_data_type_quantized_asymmetric(DataType dt)
Check if a given data type is of asymmetric quantized type.
Definition: Utils.h:794
+
bool is_data_type_quantized_asymmetric(DataType dt)
Check if a given data type is of asymmetric quantized type.
Definition: Utils.h:1029
DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(concat(datasets::SmallShapes(), datasets::LargeShapes()), AbsoluteDifferenceU8Dataset), shape, data_type0, data_type1, output_data_type)
TEST_SUITE_END() DATA_TEST_CASE(Configuration
-
const ValidRegion dst_valid_region
+
const ValidRegion dst_valid_region
ARM_COMPUTE_EXPECT(src.info() ->is_resizable(), framework::LogLevel::ERRORS)
+
combine(combine(combine(concat(datasets::SmallShapes(), datasets::LargeShapes()), framework::dataset::make("DataType",{DataType::U8, DataType::S16})), datasets::BorderModes()), framework::dataset::make("filter_size",{5}))
JoinDataset< T, U > concat(T &&dataset1, U &&dataset2)
Helper function to create a JoinDataset.
Definition: JoinDataset.h:142
@@ -156,7 +156,7 @@ $(document).ready(function(){initNavTree('validation_2_g_l_e_s___c_o_m_p_u_t_e_2 -
convolution configure & src
+
convolution configure & src
ValidRegion shape_to_valid_region(const TensorShape &a_shape, bool border_undefined=false, BorderSize border_size=BorderSize(0))
Create a valid region based on tensor shape, border mode and border size.
Definition: Utils.h:212
@@ -165,7 +165,7 @@ $(document).ready(function(){initNavTree('validation_2_g_l_e_s___c_o_m_p_u_t_e_2