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

Function ClSplitterConcatTest

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

Source from the content-addressed store, hash-verified

833
834template <typename armnn::DataType DataType>
835static void ClSplitterConcatTest()
836{
837 // Tests that it is possible to decide which output of the splitter layer
838 // should be lined to which input of the concat layer.
839 // We test that is is possible to specify 0th output
840 // of the splitter to be the 1st input to the concat and the 1st output of the splitter to be 0th input
841 // of the concat.
842
843 Graph graph;
844 ClWorkloadFactory factory =
845 ClWorkloadFactoryHelper::GetFactory(ClWorkloadFactoryHelper::GetMemoryManager());
846
847 auto workloads =
848 CreateSplitterConcatWorkloadTest<ClSplitterWorkload, ClConcatWorkload, DataType>
849 (factory, graph);
850
851 auto wlSplitter = std::move(workloads.first);
852 auto wlConcat = std::move(workloads.second);
853
854 //Checks that the index of inputs/outputs matches what we declared on InputDescriptor construction.
855 armnn::ClSubTensorHandle* sOut0 = dynamic_cast<armnn::ClSubTensorHandle*>(wlSplitter->GetData().m_Outputs[0]);
856 armnn::ClSubTensorHandle* sOut1 = dynamic_cast<armnn::ClSubTensorHandle*>(wlSplitter->GetData().m_Outputs[1]);
857 armnn::ClSubTensorHandle* mIn0 = dynamic_cast<armnn::ClSubTensorHandle*>(wlConcat->GetData().m_Inputs[0]);
858 armnn::ClSubTensorHandle* mIn1 = dynamic_cast<armnn::ClSubTensorHandle*>(wlConcat->GetData().m_Inputs[1]);
859
860 CHECK(sOut0);
861 CHECK(sOut1);
862 CHECK(mIn0);
863 CHECK(mIn1);
864
865 //Fliped order of inputs/outputs.
866 bool validDataPointers = (sOut0 == mIn1) && (sOut1 == mIn0);
867 CHECK(validDataPointers);
868
869
870 //Also make sure that the inputs are subtensors of one tensor and outputs are sub tensors of another tensor.
871 bool validSubTensorParents = (mIn0->GetTensor().parent() == mIn1->GetTensor().parent())
872 && (sOut0->GetTensor().parent() == sOut1->GetTensor().parent());
873
874 CHECK(validSubTensorParents);
875}
876
877TEST_CASE_FIXTURE(ClContextControlFixture, "CreateSplitterConcatFloatWorkload")
878{

Callers

nothing calls this directly

Calls 4

GetFactoryFunction · 0.85
parentMethod · 0.80
GetTensorMethod · 0.80
GetDataMethod · 0.45

Tested by

no test coverage detected