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

Method ParseBatchMatMul

src/armnnTfLiteParser/TfLiteParser.cpp:1845–1886  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1843}
1844
1845void TfLiteParserImpl::ParseBatchMatMul(size_t subgraphIndex, size_t operatorIndex)
1846{
1847 CHECK_MODEL(m_Model, subgraphIndex, operatorIndex);
1848
1849 auto inputs = GetInputs(m_Model, subgraphIndex, operatorIndex);
1850 CHECK_VALID_SIZE(inputs.size(), 2);
1851
1852 auto outputs = GetOutputs(m_Model, subgraphIndex, operatorIndex);
1853 CHECK_VALID_SIZE(outputs.size(), 1);
1854
1855 auto layerName = fmt::format("BatchMatMul:{}:{}", subgraphIndex, operatorIndex);
1856
1857 TensorInfo inputXTensorInfo = InputTensorInfo(subgraphIndex, operatorIndex, 0);
1858 TensorInfo inputYTensorInfo = InputTensorInfo(subgraphIndex, operatorIndex, 1);
1859
1860 const auto& operatorPtr = m_Model->subgraphs[subgraphIndex]->operators[operatorIndex];
1861 const auto* options = operatorPtr->builtin_options.AsBatchMatMulOptions();
1862
1863 // Adjoint in tensorflow lite performs transpose operation
1864 BatchMatMulDescriptor descriptor(options->adj_x,
1865 options->adj_y,
1866 false,
1867 false);
1868 // Arbitrary DataLayout
1869
1870 IConnectableLayer* layer = m_Network->AddBatchMatMulLayer(descriptor, layerName.c_str());
1871
1872 if (!layer)
1873 {
1874 throw NullPointerException(fmt::format("Layer {} pointer is null {}",
1875 operatorIndex, CHECK_LOCATION().AsString()));
1876 }
1877
1878 TensorInfo outputTensorInfo = OutputTensorInfoFromInputs(subgraphIndex, operatorIndex, layer, 0, {0, 1});
1879 layer->GetOutputSlot(0).SetTensorInfo(outputTensorInfo);
1880
1881 auto inputTensorIndexes = AsUnsignedVector(GetInputTensorIds(m_Model, subgraphIndex, operatorIndex));
1882 RegisterInputSlots(subgraphIndex, operatorIndex, layer, {inputTensorIndexes[0], inputTensorIndexes[1]});
1883
1884 auto outputTensorIndexes = AsUnsignedVector(GetOutputTensorIds(m_Model, subgraphIndex, operatorIndex));
1885 RegisterOutputSlots(subgraphIndex, operatorIndex, layer, {outputTensorIndexes[0]});
1886}
1887
1888void TfLiteParserImpl::ParseBatchToSpaceND(size_t subgraphIndex, size_t operatorIndex)
1889{

Callers

nothing calls this directly

Calls 9

formatEnum · 0.85
AsUnsignedVectorFunction · 0.85
AddBatchMatMulLayerMethod · 0.80
GetOutputSlotMethod · 0.80
sizeMethod · 0.45
c_strMethod · 0.45
AsStringMethod · 0.45
SetTensorInfoMethod · 0.45

Tested by

no test coverage detected