From 17d6d3cb0f92517b3764870b85cb7ffd22332556 Mon Sep 17 00:00:00 2001 From: Georgios Pinitas Date: Mon, 2 Jul 2018 17:52:40 +0100 Subject: COMPMID-1352: Disable support for 4D softmax layer. Change-Id: Ia8afabb36e644895d321ded51a6a0676347443e1 Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/138387 Reviewed-by: Gian Marco Iodice Tested-by: Jenkins --- src/runtime/CL/functions/CLSoftmaxLayer.cpp | 1 + src/runtime/NEON/functions/NESoftmaxLayer.cpp | 1 + tests/datasets/ShapeDatasets.h | 13 +++++-------- tests/validation/CL/SoftmaxLayer.cpp | 26 ++++++++++++++------------ tests/validation/NEON/SoftmaxLayer.cpp | 16 +++++++++------- 5 files changed, 30 insertions(+), 27 deletions(-) diff --git a/src/runtime/CL/functions/CLSoftmaxLayer.cpp b/src/runtime/CL/functions/CLSoftmaxLayer.cpp index d6ab941b80..7a20d9f94b 100644 --- a/src/runtime/CL/functions/CLSoftmaxLayer.cpp +++ b/src/runtime/CL/functions/CLSoftmaxLayer.cpp @@ -77,6 +77,7 @@ void CLSoftmaxLayer::configure(const ICLTensor *input, ICLTensor *output, float Status CLSoftmaxLayer::validate(const ITensorInfo *input, const ITensorInfo *output) { ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(input, output); + ARM_COMPUTE_RETURN_ERROR_ON_MSG(input->num_dimensions() > 2, "Only 2D inputs are supported"); // Create intermediate tensor info DataType tmp_data_type = is_data_type_quantized_asymmetric(input->data_type()) ? DataType::S32 : input->data_type(); diff --git a/src/runtime/NEON/functions/NESoftmaxLayer.cpp b/src/runtime/NEON/functions/NESoftmaxLayer.cpp index 4fb83007c5..3a73f1efeb 100644 --- a/src/runtime/NEON/functions/NESoftmaxLayer.cpp +++ b/src/runtime/NEON/functions/NESoftmaxLayer.cpp @@ -62,6 +62,7 @@ Status NESoftmaxLayer::validate(const ITensorInfo *input, const ITensorInfo *out { // Perform validation step ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(input, output); + ARM_COMPUTE_RETURN_ERROR_ON_MSG(input->num_dimensions() > 2, "Only 2D inputs are supported"); const TensorShape max_shape = TensorShape(input->tensor_shape()).set(0, 1); const TensorInfo tensor_info_max_sum = TensorInfo(*input).set_tensor_shape(max_shape).reset_padding(); diff --git a/tests/datasets/ShapeDatasets.h b/tests/datasets/ShapeDatasets.h index 68263c7793..766530b0d7 100644 --- a/tests/datasets/ShapeDatasets.h +++ b/tests/datasets/ShapeDatasets.h @@ -627,7 +627,7 @@ public: : ShapeDataset("Shape", { TensorShape{ 9U, 9U }, - TensorShape{ 128U, 10U, 2U }, + TensorShape{ 128U, 10U }, }) { } @@ -641,11 +641,9 @@ public: : ShapeDataset("Shape", { TensorShape{ 9U, 9U }, - TensorShape{ 256U, 10U, 2U }, - TensorShape{ 353U, 8U, 2U, 2U }, - TensorShape{ 512U, 7U, 2U, 2U }, - TensorShape{ 633U, 10U, 1U, 2U }, - TensorShape{ 781U, 5U, 2U }, + TensorShape{ 256U, 10U }, + TensorShape{ 353U, 8U }, + TensorShape{ 781U, 5U }, }) { } @@ -659,8 +657,7 @@ public: : ShapeDataset("Shape", { TensorShape{ 1000U, 10U }, - TensorShape{ 3989U, 10U, 2U }, - TensorShape{ 4098U, 8U, 1U, 2U }, + TensorShape{ 3989U, 10U }, TensorShape{ 7339U, 11U }, }) { diff --git a/tests/validation/CL/SoftmaxLayer.cpp b/tests/validation/CL/SoftmaxLayer.cpp index 114529edfd..b47f84f8cd 100644 --- a/tests/validation/CL/SoftmaxLayer.cpp +++ b/tests/validation/CL/SoftmaxLayer.cpp @@ -99,25 +99,27 @@ DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(concat(datase // *INDENT-OFF* // clang-format off DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip( - framework::dataset::make("InputInfo", { TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Mismatching data types - TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Mismatching shapes - TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::QASYMM8, // Invalid output quantization info + framework::dataset::make("InputInfo", { TensorInfo(TensorShape(27U, 13U), 1, DataType::F32), // Mismatching data types + TensorInfo(TensorShape(27U, 13U), 1, DataType::F32), // Mismatching shapes + TensorInfo(TensorShape(27U, 13U), 1, DataType::QASYMM8, // Invalid output quantization info QuantizationInfo(1.f/256, 12)), - TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Window shrink - TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::F32), - TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QASYMM8, + TensorInfo(TensorShape(27U, 13U), 1, DataType::F32), // Window shrink + TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32),// Invalid input dimensionality + TensorInfo(TensorShape(32U, 13U), 1, DataType::F32), + TensorInfo(TensorShape(32U, 13U), 1, DataType::QASYMM8, QuantizationInfo(1.f/256, 12)), }), - framework::dataset::make("OutputInfo",{ TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F16), - TensorInfo(TensorShape(27U, 11U, 2U), 1, DataType::F32), - TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::QASYMM8, + framework::dataset::make("OutputInfo",{ TensorInfo(TensorShape(27U, 13U), 1, DataType::F16), + TensorInfo(TensorShape(27U, 11U), 1, DataType::F32), + TensorInfo(TensorShape(27U, 13U), 1, DataType::QASYMM8, QuantizationInfo(1.f/256, 12)), + TensorInfo(TensorShape(27U, 13U), 1, DataType::F32), TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), - TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::F32), - TensorInfo(TensorShape(32U, 13U, 2U), 1, DataType::QASYMM8, + TensorInfo(TensorShape(32U, 13U), 1, DataType::F32), + TensorInfo(TensorShape(32U, 13U), 1, DataType::QASYMM8, QuantizationInfo(1.f/256, 0)), })), - framework::dataset::make("Expected", { false, false, false, false, true, true })), + framework::dataset::make("Expected", { false, false, false, false, false, true, true })), input_info, output_info, expected) { ARM_COMPUTE_EXPECT(bool(CLSoftmaxLayer::validate(&input_info.clone()->set_is_resizable(false), &output_info.clone()->set_is_resizable(false))) == expected, framework::LogLevel::ERRORS); diff --git a/tests/validation/NEON/SoftmaxLayer.cpp b/tests/validation/NEON/SoftmaxLayer.cpp index 4a1aa23ac1..b6efc8f9b5 100644 --- a/tests/validation/NEON/SoftmaxLayer.cpp +++ b/tests/validation/NEON/SoftmaxLayer.cpp @@ -95,15 +95,17 @@ DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(concat(datase // *INDENT-OFF* // clang-format off DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip( - framework::dataset::make("InputInfo", { TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Mismatching data types - TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Mismatching shapes - TensorInfo(TensorShape(32U, 16U, 2U), 1, DataType::F32), + framework::dataset::make("InputInfo", { TensorInfo(TensorShape(27U, 13U), 1, DataType::F32), // Mismatching data types + TensorInfo(TensorShape(27U, 13U), 1, DataType::F32), // Mismatching shapes + TensorInfo(TensorShape(32U, 16U, 2U), 1, DataType::F32), // Invalid input dimensionality + TensorInfo(TensorShape(32U, 16U), 1, DataType::F32), }), - framework::dataset::make("OutputInfo",{ TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F16), - TensorInfo(TensorShape(27U, 11U, 2U), 1, DataType::F32), - TensorInfo(TensorShape(32U, 16U, 2U), 1, DataType::F32), + framework::dataset::make("OutputInfo",{ TensorInfo(TensorShape(27U, 13U), 1, DataType::F16), + TensorInfo(TensorShape(27U, 11U), 1, DataType::F32), + TensorInfo(TensorShape(27U, 11U), 1, DataType::F32), + TensorInfo(TensorShape(32U, 16U), 1, DataType::F32), })), - framework::dataset::make("Expected", { false, false, true })), + framework::dataset::make("Expected", { false, false, false, true })), input_info, output_info, expected) { bool is_valid = bool(NESoftmaxLayer::validate(&input_info.clone()->set_is_resizable(false), &output_info.clone()->set_is_resizable(false))); -- cgit v1.2.1