From a2b89ca5407532257a959ad1852f29187e1be4ac Mon Sep 17 00:00:00 2001 From: Pablo Palmier Date: Thu, 5 Oct 2017 15:01:34 +0100 Subject: IVGCVSW-631 Neon support for Softmax beta parameter (F32 only) Change-Id: Ibf6f038b39f1a4e557f5d04feb08e3d5ef54e223 Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/112019 Tested-by: BSG Visual Compute Jenkins server to access repositories on http://mpd-gerrit.cambridge.arm.com Reviewed-by: Anthony Barbier Reviewed-by: Georgios Pinitas --- tests/validation/fixtures/SoftmaxLayerFixture.h | 38 +++++++++++++++++-------- 1 file changed, 26 insertions(+), 12 deletions(-) (limited to 'tests/validation/fixtures') diff --git a/tests/validation/fixtures/SoftmaxLayerFixture.h b/tests/validation/fixtures/SoftmaxLayerFixture.h index 3ffbc6aac7..c2ab2e2ef6 100644 --- a/tests/validation/fixtures/SoftmaxLayerFixture.h +++ b/tests/validation/fixtures/SoftmaxLayerFixture.h @@ -47,13 +47,13 @@ class SoftmaxValidationGenericFixture : public framework::Fixture { public: template - void setup(TensorShape shape, DataType data_type, int fractional_bits, QuantizationInfo quantization_info) + void setup(TensorShape shape, DataType data_type, int fractional_bits, QuantizationInfo quantization_info, float beta) { _fractional_bits = fractional_bits; _quantization_info = quantization_info; - _target = compute_target(shape, data_type, fractional_bits, quantization_info); - _reference = compute_reference(shape, data_type, fractional_bits, quantization_info); + _target = compute_target(shape, data_type, fractional_bits, quantization_info, beta); + _reference = compute_reference(shape, data_type, fractional_bits, quantization_info, beta); } protected: @@ -78,7 +78,8 @@ protected: } } - TensorType compute_target(const TensorShape &shape, DataType data_type, int fixed_point_position, QuantizationInfo quantization_info) + TensorType compute_target(const TensorShape &shape, DataType data_type, int fixed_point_position, + QuantizationInfo quantization_info, float beta) { // Create tensors TensorType src = create_tensor(shape, data_type, 1, fixed_point_position, quantization_info); @@ -86,7 +87,7 @@ protected: // Create and configure function FunctionType smx_layer; - smx_layer.configure(&src, &dst); + smx_layer.configure(&src, &dst, beta); ARM_COMPUTE_EXPECT(src.info()->is_resizable(), framework::LogLevel::ERRORS); ARM_COMPUTE_EXPECT(dst.info()->is_resizable(), framework::LogLevel::ERRORS); @@ -107,7 +108,8 @@ protected: return dst; } - SimpleTensor compute_reference(const TensorShape &shape, DataType data_type, int fixed_point_position, QuantizationInfo quantization_info) + SimpleTensor compute_reference(const TensorShape &shape, DataType data_type, int fixed_point_position, + QuantizationInfo quantization_info, float beta) { // Create reference SimpleTensor src{ shape, data_type, 1, fixed_point_position, quantization_info }; @@ -115,7 +117,7 @@ protected: // Fill reference fill(src); - return reference::softmax_layer(src); + return reference::softmax_layer(src, beta); } TensorType _target{}; @@ -129,9 +131,13 @@ class SoftmaxValidationFixture : public SoftmaxValidationGenericFixture - void setup(TensorShape shape, DataType data_type) + void setup(TensorShape shape, DataType data_type, float beta) { - SoftmaxValidationGenericFixture::setup(shape, data_type, 0, QuantizationInfo()); + SoftmaxValidationGenericFixture::setup(shape, + data_type, + 0, + QuantizationInfo(), + beta); } }; @@ -142,7 +148,11 @@ public: template void setup(TensorShape shape, DataType data_type, int fixed_point_position) { - SoftmaxValidationGenericFixture::setup(shape, data_type, fixed_point_position, QuantizationInfo()); + SoftmaxValidationGenericFixture::setup(shape, + data_type, + fixed_point_position, + QuantizationInfo(), + 1.0f); } }; @@ -151,9 +161,13 @@ class SoftmaxValidationQuantizedFixture : public SoftmaxValidationGenericFixture { public: template - void setup(TensorShape shape, DataType data_type, QuantizationInfo quantization_info) + void setup(TensorShape shape, DataType data_type, QuantizationInfo quantization_info, float beta) { - SoftmaxValidationGenericFixture::setup(shape, data_type, 0, quantization_info); + SoftmaxValidationGenericFixture::setup(shape, + data_type, + 0, + quantization_info, + beta); } }; } // namespace validation -- cgit v1.2.1