IVGCVSW-3554 Update workloads to pass Softmax Axis Parameter to Backends
* Add check in CL and Neon to ensure axis is 1 otherwise
return unsupported.
* Edit CreateWorkload test and JsonPrinter test to ensure axis of 1.
Change-Id: I499b405532e26fefc2dd1c18b6dc6005813b5604
Signed-off-by: Francis Murtagh <francis.murtagh@arm.com>
diff --git a/src/backends/neon/NeonLayerSupport.cpp b/src/backends/neon/NeonLayerSupport.cpp
index cb709c3..e856210 100644
--- a/src/backends/neon/NeonLayerSupport.cpp
+++ b/src/backends/neon/NeonLayerSupport.cpp
@@ -538,6 +538,12 @@
const SoftmaxDescriptor& descriptor,
Optional<std::string&> reasonIfUnsupported) const
{
+ if (!(descriptor.m_Axis == 1 ||
+ (descriptor.m_Axis < 0 && static_cast<int>(input.GetNumDimensions()) + descriptor.m_Axis == 1)))
+ {
+ SetValueChecked(reasonIfUnsupported, "Neon Softmax: Only supports Axis equal to 1.");
+ return false;
+ }
FORWARD_WORKLOAD_VALIDATE_FUNC(NeonSoftmaxWorkloadValidate, reasonIfUnsupported, input, output, descriptor);
}
diff --git a/src/backends/neon/workloads/NeonSoftmaxBaseWorkload.cpp b/src/backends/neon/workloads/NeonSoftmaxBaseWorkload.cpp
index b229bc4..8acb775 100644
--- a/src/backends/neon/workloads/NeonSoftmaxBaseWorkload.cpp
+++ b/src/backends/neon/workloads/NeonSoftmaxBaseWorkload.cpp
@@ -6,6 +6,7 @@
#include "NeonSoftmaxBaseWorkload.hpp"
#include <aclCommon/ArmComputeTensorUtils.hpp>
+#include <aclCommon/ArmComputeUtils.hpp>
#include <arm_compute/runtime/NEON/functions/NESoftmaxLayer.h>
@@ -19,7 +20,8 @@
const arm_compute::TensorInfo aclInputInfo = armcomputetensorutils::BuildArmComputeTensorInfo(input);
const arm_compute::TensorInfo aclOutputInfo = armcomputetensorutils::BuildArmComputeTensorInfo(output);
- return arm_compute::NESoftmaxLayer::validate(&aclInputInfo, &aclOutputInfo, descriptor.m_Beta);
+ unsigned int aclAxis = ComputeSoftmaxAclAxis(input);
+ return arm_compute::NESoftmaxLayer::validate(&aclInputInfo, &aclOutputInfo, descriptor.m_Beta, aclAxis);
}
} //namespace armnn
diff --git a/src/backends/neon/workloads/NeonSoftmaxFloatWorkload.cpp b/src/backends/neon/workloads/NeonSoftmaxFloatWorkload.cpp
index 19c50db..4dc9131 100644
--- a/src/backends/neon/workloads/NeonSoftmaxFloatWorkload.cpp
+++ b/src/backends/neon/workloads/NeonSoftmaxFloatWorkload.cpp
@@ -23,8 +23,8 @@
arm_compute::ITensor& input = boost::polymorphic_downcast<IAclTensorHandle*>(m_Data.m_Inputs[0])->GetTensor();
arm_compute::ITensor& output = boost::polymorphic_downcast<IAclTensorHandle*>(m_Data.m_Outputs[0])->GetTensor();
- unsigned int aclAxis = ComputeSoftmaxAclAxis(info.m_InputTensorInfos[0]);
auto layer = std::make_unique<arm_compute::NESoftmaxLayer>(memoryManager);
+ unsigned int aclAxis = ComputeSoftmaxAclAxis(info.m_InputTensorInfos[0]);
layer->configure(&input, &output, m_Data.m_Parameters.m_Beta, aclAxis);
m_SoftmaxLayer.reset(layer.release());
}
diff --git a/src/backends/neon/workloads/NeonSoftmaxUint8Workload.cpp b/src/backends/neon/workloads/NeonSoftmaxUint8Workload.cpp
index 363c150..8e83914 100644
--- a/src/backends/neon/workloads/NeonSoftmaxUint8Workload.cpp
+++ b/src/backends/neon/workloads/NeonSoftmaxUint8Workload.cpp
@@ -33,9 +33,8 @@
"Invalid quantization for output. Only scale = 1.0f / 256.0f and offset = 0 supported");
}
- unsigned int aclAxis = ComputeSoftmaxAclAxis(info.m_InputTensorInfos[0]);
-
auto layer = std::make_unique<arm_compute::NESoftmaxLayer>(memoryManager);
+ unsigned int aclAxis = ComputeSoftmaxAclAxis(info.m_InputTensorInfos[0]);
layer->configure(&input, &output, descriptor.m_Parameters.m_Beta, aclAxis);
m_SoftmaxLayer.reset(layer.release());
}