diff options
author | John Kesapides <john.kesapides@arm.com> | 2019-02-22 10:05:29 +0000 |
---|---|---|
committer | John Kesapides <john.kesapides@arm.com> | 2019-03-20 11:29:30 +0000 |
commit | 341b218eff8c75aa9862b333bb0012a03c14a1ef (patch) | |
tree | f88dc425907bbaa866144161a2ade5e9b50557ab /tests/validation/reference/FullyConnectedLayer.cpp | |
parent | 0ae5de9124a0094e656244ad2f807c084966fc04 (diff) | |
download | ComputeLibrary-341b218eff8c75aa9862b333bb0012a03c14a1ef.tar.gz |
COMPMID-1493 Create tests/validate_examples/graph_fully_connected
Add graph example with validation for fully-connected layer
Change-Id: I06fcc670b7097609f04eb040fedf56108c9484d2
Signed-off-by: John Kesapides <john.kesapides@arm.com>
Reviewed-on: https://review.mlplatform.org/c/764
Tested-by: Arm Jenkins <bsgcomp@arm.com>
Reviewed-by: Pablo Marquez <pablo.tello@arm.com>
Reviewed-by: Georgios Pinitas <georgios.pinitas@arm.com>
Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'tests/validation/reference/FullyConnectedLayer.cpp')
-rw-r--r-- | tests/validation/reference/FullyConnectedLayer.cpp | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/tests/validation/reference/FullyConnectedLayer.cpp b/tests/validation/reference/FullyConnectedLayer.cpp index d65d0caab0..07ddf6d308 100644 --- a/tests/validation/reference/FullyConnectedLayer.cpp +++ b/tests/validation/reference/FullyConnectedLayer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018 ARM Limited. + * Copyright (c) 2017-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -105,10 +105,16 @@ void vector_matrix_multiply(const SimpleTensor<T> &src, const SimpleTensor<T> &w } // namespace template <typename T, typename TB> -SimpleTensor<T> fully_connected_layer(const SimpleTensor<T> &src, const SimpleTensor<T> &weights, const SimpleTensor<TB> &bias, const TensorShape &dst_shape) +SimpleTensor<T> fully_connected_layer(const SimpleTensor<T> &src, const SimpleTensor<T> &weights, const SimpleTensor<TB> &bias, const TensorShape &dst_shape, QuantizationInfo out_quant_info) { + // if no explicit quantization has been set you the same as src + if(out_quant_info == QuantizationInfo()) + { + out_quant_info = src.quantization_info(); + } + // Create reference - SimpleTensor<T> dst{ TensorShape{ dst_shape }, src.data_type(), 1, src.quantization_info() }; + SimpleTensor<T> dst{ TensorShape{ dst_shape }, src.data_type(), 1, out_quant_info }; // Sanity checks const int num_batch_dimensions = std::max(0, static_cast<int>(dst_shape.num_dimensions()) - 1); @@ -145,9 +151,12 @@ SimpleTensor<T> fully_connected_layer(const SimpleTensor<T> &src, const SimpleTe return dst; } -template SimpleTensor<float> fully_connected_layer(const SimpleTensor<float> &src, const SimpleTensor<float> &weights, const SimpleTensor<float> &bias, const TensorShape &dst_shape); -template SimpleTensor<half> fully_connected_layer(const SimpleTensor<half> &src, const SimpleTensor<half> &weights, const SimpleTensor<half> &bias, const TensorShape &dst_shape); -template SimpleTensor<uint8_t> fully_connected_layer(const SimpleTensor<uint8_t> &src, const SimpleTensor<uint8_t> &weights, const SimpleTensor<int32_t> &bias, const TensorShape &dst_shape); +template SimpleTensor<float> fully_connected_layer(const SimpleTensor<float> &src, const SimpleTensor<float> &weights, const SimpleTensor<float> &bias, const TensorShape &dst_shape, + QuantizationInfo out_quant_info); +template SimpleTensor<half> fully_connected_layer(const SimpleTensor<half> &src, const SimpleTensor<half> &weights, const SimpleTensor<half> &bias, const TensorShape &dst_shape, + QuantizationInfo out_quant_info); +template SimpleTensor<uint8_t> fully_connected_layer(const SimpleTensor<uint8_t> &src, const SimpleTensor<uint8_t> &weights, const SimpleTensor<int32_t> &bias, const TensorShape &dst_shape, + QuantizationInfo out_quant_info); } // namespace reference } // namespace validation } // namespace test |