diff options
author | Pablo Tello <pablo.tello@arm.com> | 2017-07-05 11:32:17 +0100 |
---|---|---|
committer | Anthony Barbier <anthony.barbier@arm.com> | 2018-09-17 14:16:42 +0100 |
commit | 91654c45cf1de5f41127536a0fdd310c17fdfc8e (patch) | |
tree | 1cf914061c456282f0ba899ebbdc591cabc7f0fc /tests/validation/Reference.cpp | |
parent | ec69f93dc63408933d322ec27d0b7049b9a6e07c (diff) | |
download | ComputeLibrary-91654c45cf1de5f41127536a0fdd310c17fdfc8e.tar.gz |
COMPMID-421: Added FP16 support in ActivationLayer.
Change-Id: I7ba573b19d56e3c87996edb5218a00e5bfca451e
Reviewed-on: http://mpd-gerrit.cambridge.arm.com/79755
Reviewed-by: Anthony Barbier <anthony.barbier@arm.com>
Tested-by: Kaizen <jeremy.johnson+kaizengerrit@arm.com>
Diffstat (limited to 'tests/validation/Reference.cpp')
-rw-r--r-- | tests/validation/Reference.cpp | 51 |
1 files changed, 33 insertions, 18 deletions
diff --git a/tests/validation/Reference.cpp b/tests/validation/Reference.cpp index 3b429c1ee6..0ce25c5567 100644 --- a/tests/validation/Reference.cpp +++ b/tests/validation/Reference.cpp @@ -459,29 +459,44 @@ RawTensor Reference::compute_reference_activation_layer(const TensorShape &shape RawTensor ref_src = library->get(shape, dt, 1, fixed_point_position); RawTensor ref_dst = library->get(shape, dt, 1, fixed_point_position); - // Fill reference - if(dt == DataType::F32) - { - float min_bound = 0; - float max_bound = 0; - std::tie(min_bound, max_bound) = get_activation_layer_test_bounds<float>(act_info.activation()); - std::uniform_real_distribution<> distribution(min_bound, max_bound); - library->fill(ref_src, distribution, 0); - } - else + // Fill tensors + switch(dt) { - int min_bound = 0; - int max_bound = 0; - if(dt == DataType::QS8) + case DataType::QS8: { - std::tie(min_bound, max_bound) = get_activation_layer_test_bounds<int8_t>(act_info.activation(), fixed_point_position); + const std::pair<int8_t, int8_t> bounds = get_activation_layer_test_bounds<int8_t>(act_info.activation(), fixed_point_position); + std::uniform_int_distribution<> distribution(bounds.first, bounds.second); + library->fill(ref_src, distribution, 0); + break; } - else + case DataType::QS16: { - std::tie(min_bound, max_bound) = get_activation_layer_test_bounds<int16_t>(act_info.activation(), fixed_point_position); + const std::pair<int16_t, int16_t> bounds = get_activation_layer_test_bounds<int16_t>(act_info.activation(), fixed_point_position); + std::uniform_int_distribution<> distribution(bounds.first, bounds.second); + library->fill(ref_src, distribution, 0); + break; + } +#ifdef ARM_COMPUTE_ENABLE_FP16 + case DataType::F16: + { + const std::pair<float16_t, float16_t> bounds = get_activation_layer_test_bounds<float16_t>(act_info.activation()); + std::uniform_real_distribution<> distribution(bounds.first, bounds.second); + library->fill(ref_src, distribution, 0); + break; + } +#endif /* ARM_COMPUTE_ENABLE_FP16 */ + case DataType::F32: + { + const std::pair<float, float> bounds = get_activation_layer_test_bounds<float>(act_info.activation()); + std::uniform_real_distribution<> distribution(bounds.first, bounds.second); + library->fill(ref_src, distribution, 0); + break; + } + default: + { + ARM_COMPUTE_ERROR("Not supported"); + break; } - std::uniform_int_distribution<> distribution(min_bound, max_bound); - library->fill(ref_src, distribution, 0); } // Compute reference |