MCPcopy Create free account
hub / github.com/ARM-software/armnn / ClSoftmaxWorkloadTest

Function ClSoftmaxWorkloadTest

src/backends/cl/test/ClCreateWorkloadTests.cpp:744–773  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

742
743template <typename SoftmaxWorkloadType, typename armnn::DataType DataType>
744static void ClSoftmaxWorkloadTest()
745{
746 Graph graph;
747 ClWorkloadFactory factory =
748 ClWorkloadFactoryHelper::GetFactory(ClWorkloadFactoryHelper::GetMemoryManager());
749
750 auto workload = CreateSoftmaxWorkloadTest<SoftmaxWorkloadType, DataType>(factory, graph);
751
752 // Checks that inputs/outputs are as we expect them (see definition of ClSoftmaxFloatWorkload).
753 SoftmaxQueueDescriptor queueDescriptor = workload->GetData();
754 auto inputHandle = PolymorphicDowncast<IClTensorHandle*>(queueDescriptor.m_Inputs[0]);
755 auto outputHandle = PolymorphicDowncast<IClTensorHandle*>(queueDescriptor.m_Outputs[0]);
756
757 armnn::TensorInfo tensorInfo({4, 1}, DataType);
758 if (DataType == armnn::DataType::QAsymmU8)
759 {
760 tensorInfo.SetQuantizationOffset(0);
761 tensorInfo.SetQuantizationScale(1.f / 256);
762 }
763 else if (DataType == armnn::DataType::QAsymmS8)
764 {
765 tensorInfo.SetQuantizationOffset(-128);
766 tensorInfo.SetQuantizationScale(1.f / 256);
767 }
768
769 auto predResult = CompareIClTensorHandleShape(inputHandle, {4, 1});
770 CHECK_MESSAGE(predResult.m_Result, predResult.m_Message.str());
771 predResult = CompareIClTensorHandleShape(outputHandle, {4, 1});
772 CHECK_MESSAGE(predResult.m_Result, predResult.m_Message.str());
773}
774
775
776TEST_CASE_FIXTURE(ClContextControlFixture, "CreateSoftmaxFloat32WorkloadTest")

Callers

nothing calls this directly

Calls 6

GetFactoryFunction · 0.85
SetQuantizationOffsetMethod · 0.80
SetQuantizationScaleMethod · 0.80
GetDataMethod · 0.45
strMethod · 0.45

Tested by

no test coverage detected