From 341b218eff8c75aa9862b333bb0012a03c14a1ef Mon Sep 17 00:00:00 2001 From: John Kesapides Date: Fri, 22 Feb 2019 10:05:29 +0000 Subject: 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 Reviewed-on: https://review.mlplatform.org/c/764 Tested-by: Arm Jenkins Reviewed-by: Pablo Marquez Reviewed-by: Georgios Pinitas Comments-Addressed: Arm Jenkins --- tests/validation/reference/FullyConnectedLayer.cpp | 21 +++++++++++++++------ tests/validation/reference/FullyConnectedLayer.h | 5 +++-- 2 files changed, 18 insertions(+), 8 deletions(-) (limited to 'tests/validation') 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 &src, const SimpleTensor &w } // namespace template -SimpleTensor fully_connected_layer(const SimpleTensor &src, const SimpleTensor &weights, const SimpleTensor &bias, const TensorShape &dst_shape) +SimpleTensor fully_connected_layer(const SimpleTensor &src, const SimpleTensor &weights, const SimpleTensor &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 dst{ TensorShape{ dst_shape }, src.data_type(), 1, src.quantization_info() }; + SimpleTensor dst{ TensorShape{ dst_shape }, src.data_type(), 1, out_quant_info }; // Sanity checks const int num_batch_dimensions = std::max(0, static_cast(dst_shape.num_dimensions()) - 1); @@ -145,9 +151,12 @@ SimpleTensor fully_connected_layer(const SimpleTensor &src, const SimpleTe return dst; } -template SimpleTensor fully_connected_layer(const SimpleTensor &src, const SimpleTensor &weights, const SimpleTensor &bias, const TensorShape &dst_shape); -template SimpleTensor fully_connected_layer(const SimpleTensor &src, const SimpleTensor &weights, const SimpleTensor &bias, const TensorShape &dst_shape); -template SimpleTensor fully_connected_layer(const SimpleTensor &src, const SimpleTensor &weights, const SimpleTensor &bias, const TensorShape &dst_shape); +template SimpleTensor fully_connected_layer(const SimpleTensor &src, const SimpleTensor &weights, const SimpleTensor &bias, const TensorShape &dst_shape, + QuantizationInfo out_quant_info); +template SimpleTensor fully_connected_layer(const SimpleTensor &src, const SimpleTensor &weights, const SimpleTensor &bias, const TensorShape &dst_shape, + QuantizationInfo out_quant_info); +template SimpleTensor fully_connected_layer(const SimpleTensor &src, const SimpleTensor &weights, const SimpleTensor &bias, const TensorShape &dst_shape, + QuantizationInfo out_quant_info); } // namespace reference } // namespace validation } // namespace test diff --git a/tests/validation/reference/FullyConnectedLayer.h b/tests/validation/reference/FullyConnectedLayer.h index 1dfb496924..f474a1cfb8 100644 --- a/tests/validation/reference/FullyConnectedLayer.h +++ b/tests/validation/reference/FullyConnectedLayer.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 ARM Limited. + * Copyright (c) 2017-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -36,7 +36,8 @@ namespace validation namespace reference { template -SimpleTensor fully_connected_layer(const SimpleTensor &src, const SimpleTensor &weights, const SimpleTensor &bias, const TensorShape &dst_shape); +SimpleTensor fully_connected_layer(const SimpleTensor &src, const SimpleTensor &weights, const SimpleTensor &bias, const TensorShape &dst_shape, + QuantizationInfo out_quant_info = QuantizationInfo()); } // namespace reference } // namespace validation } // namespace test -- cgit v1.2.1