{
// Create the layer we're testing.
SoftmaxDescriptor softmaxDescriptor;
- Layer* const layer = graph.AddLayer<SoftmaxLayer>(softmaxDescriptor, "layer");
+ // Set Axis to 1 if CL or Neon until further Axes are supported.
+ if (factory.GetBackendId() == armnn::Compute::CpuAcc || factory.GetBackendId() == armnn::Compute::GpuAcc)
+ {
+ softmaxDescriptor.m_Axis = 1;
+ }
+ Layer* const layer = graph.AddLayer<SoftmaxLayer>(softmaxDescriptor, "layer");
// Create extra layers.
Layer* const input = graph.AddLayer<InputLayer>(0, "input");
Layer* const output = graph.AddLayer<OutputLayer>(0, "output");
// Engine
armnn::SoftmaxDescriptor softmaxDescriptor;
+ softmaxDescriptor.m_Axis = 1;
armnn::IConnectableLayer* const softmaxLayer = m_Network->AddSoftmaxLayer(
softmaxDescriptor,
layerParam.name().c_str());
INetworkPtr net(INetwork::Create());
IConnectableLayer* input = net->AddInputLayer(0, "input");
- IConnectableLayer* softmax = net->AddSoftmaxLayer(SoftmaxDescriptor(), "softmax");
+ SoftmaxDescriptor softmaxDescriptor;
+ // Set Axis to 1 if CL or Neon until further Axes are supported.
+ if ( backends.front() == armnn::Compute::CpuAcc || backends.front() == armnn::Compute::GpuAcc)
+ {
+ softmaxDescriptor.m_Axis = 1;
+ }
+ IConnectableLayer* softmax = net->AddSoftmaxLayer(softmaxDescriptor, "softmax");
IConnectableLayer* output = net->AddOutputLayer(0, "output");
input->GetOutputSlot(0).Connect(softmax->GetInputSlot(0));
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, "Cl Softmax: Only supports Axis equal to 1.");
+ return false;
+ }
ignore_unused(descriptor);
- FORWARD_WORKLOAD_VALIDATE_FUNC(ClSoftmaxWorkloadValidate, reasonIfUnsupported, input, output);
+ FORWARD_WORKLOAD_VALIDATE_FUNC(ClSoftmaxWorkloadValidate, reasonIfUnsupported, input, output, descriptor);
}
bool ClLayerSupport::IsSpaceToBatchNdSupported(const TensorInfo& input,
#include "ClSoftmaxBaseWorkload.hpp"
#include <aclCommon/ArmComputeTensorUtils.hpp>
+#include <aclCommon/ArmComputeUtils.hpp>
#include <arm_compute/runtime/CL/functions/CLSoftmaxLayer.h>
{
arm_compute::Status ClSoftmaxWorkloadValidate(const TensorInfo& input,
- const TensorInfo& output)
+ const TensorInfo& output,
+ const SoftmaxDescriptor& descriptor)
{
const arm_compute::TensorInfo aclInputInfo = armcomputetensorutils::BuildArmComputeTensorInfo(input);
const arm_compute::TensorInfo aclOutputInfo = armcomputetensorutils::BuildArmComputeTensorInfo(output);
- return arm_compute::CLSoftmaxLayer::validate(&aclInputInfo, &aclOutputInfo);
+ unsigned int aclAxis = ComputeSoftmaxAclAxis(input);
+ return arm_compute::CLSoftmaxLayer::validate(&aclInputInfo, &aclOutputInfo, descriptor.m_Beta, aclAxis);
}
}
#pragma once
+#include <armnn/Descriptors.hpp>
#include <armnn/Tensor.hpp>
#include <arm_compute/core/Error.h>
{
arm_compute::Status ClSoftmaxWorkloadValidate(const TensorInfo& input,
- const TensorInfo& output);
+ const TensorInfo& output,
+ const SoftmaxDescriptor& descriptor);
} // namespace armnn
{
ClSoftmaxFloatWorkload::ClSoftmaxFloatWorkload(const SoftmaxQueueDescriptor& descriptor, const WorkloadInfo& info,
- std::shared_ptr<arm_compute::MemoryManagerOnDemand>& memoryManager)
+ std::shared_ptr<arm_compute::MemoryManagerOnDemand>& memoryManager)
: FloatWorkload<SoftmaxQueueDescriptor>(descriptor, info)
, m_SoftmaxLayer(memoryManager)
{
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);
}
#include "NeonSoftmaxBaseWorkload.hpp"
#include <aclCommon/ArmComputeTensorUtils.hpp>
+#include <aclCommon/ArmComputeUtils.hpp>
#include <arm_compute/runtime/NEON/functions/NESoftmaxLayer.h>
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
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());
}
"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());
}