diff options
author | Chunosov <N.Chunosov@yandex.ru> | 2017-11-08 16:09:35 +0700 |
---|---|---|
committer | Anthony Barbier <anthony.barbier@arm.com> | 2018-11-02 16:35:24 +0000 |
commit | f450caa7d2ac9a2a90407fb81203228dc82ef4a1 (patch) | |
tree | ed34d43943cd36cbd6776ddc6ac87e92d6f7dcc0 /tests/validation/CPP/SoftmaxLayer.cpp | |
parent | 7068f9900d136312318ff430aef588b14e0c87ad (diff) | |
download | ComputeLibrary-f450caa7d2ac9a2a90407fb81203228dc82ef4a1.tar.gz |
COMPMID-661: softmax-uint8 implementation (#16)
Change-Id: Iad11ce70a8a0878a48e445a092035c49c926cece
Reviewed-on: http://mpd-gerrit.cambridge.arm.com/94855
Tested-by: Kaizen <jeremy.johnson+kaizengerrit@arm.com>
Reviewed-by: Anthony Barbier <anthony.barbier@arm.com>
Diffstat (limited to 'tests/validation/CPP/SoftmaxLayer.cpp')
-rw-r--r-- | tests/validation/CPP/SoftmaxLayer.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/validation/CPP/SoftmaxLayer.cpp b/tests/validation/CPP/SoftmaxLayer.cpp index eb7655078c..8e8cc1bd25 100644 --- a/tests/validation/CPP/SoftmaxLayer.cpp +++ b/tests/validation/CPP/SoftmaxLayer.cpp @@ -112,6 +112,18 @@ SimpleTensor<T> softmax_layer(const SimpleTensor<T> &src) return dst; } +template <> +SimpleTensor<uint8_t> softmax_layer<uint8_t>(const SimpleTensor<uint8_t> &src) +{ + // Note: Output quantization info should always have scale = 1/256 and offset = 0 + const QuantizationInfo output_quantization_info = QuantizationInfo(1.f / 256, 0); + + SimpleTensor<float> src_tmp = convert_from_asymmetric(src); + SimpleTensor<float> dst_tmp = softmax_layer<float>(src_tmp); + SimpleTensor<uint8_t> dst = convert_to_asymmetric(dst_tmp, output_quantization_info); + return dst; +} + template SimpleTensor<float> softmax_layer(const SimpleTensor<float> &src); template SimpleTensor<half> softmax_layer(const SimpleTensor<half> &src); template SimpleTensor<qint8_t> softmax_layer(const SimpleTensor<qint8_t> &src); |