| 1644 | } |
| 1645 | |
| 1646 | void TfLiteParserImpl::ParseTranspose(size_t subgraphIndex, size_t operatorIndex) |
| 1647 | { |
| 1648 | CHECK_MODEL(m_Model, subgraphIndex, operatorIndex); |
| 1649 | |
| 1650 | auto inputs = GetInputs(m_Model, subgraphIndex, operatorIndex); |
| 1651 | CHECK_VALID_SIZE(inputs.size(), 1, 2); |
| 1652 | |
| 1653 | auto outputs = GetOutputs(m_Model, subgraphIndex, operatorIndex); |
| 1654 | CHECK_VALID_SIZE(outputs.size(), 1); |
| 1655 | |
| 1656 | auto layerName = fmt::format("Transpose:{}:{}", subgraphIndex, operatorIndex); |
| 1657 | TransposeDescriptor desc; |
| 1658 | |
| 1659 | if (inputs.size() == 2) |
| 1660 | { |
| 1661 | armnn::TensorInfo permuteTensorInfo = InputTensorInfo(subgraphIndex, operatorIndex, 1); |
| 1662 | BufferRawPtr permuteBufferPtr = GetBuffer(m_Model, inputs[1]->buffer); |
| 1663 | ValidateBuffer(permuteBufferPtr, permuteTensorInfo, "permute"); |
| 1664 | |
| 1665 | auto numPermVecElements = permuteTensorInfo.GetNumElements(); |
| 1666 | std::vector<unsigned int> permuteShape(numPermVecElements); |
| 1667 | ::memcpy(permuteShape.data(), permuteBufferPtr->data.data(), permuteTensorInfo.GetNumBytes()); |
| 1668 | PermutationVector permutationVector(permuteShape.data(), permuteTensorInfo.GetNumElements()); |
| 1669 | |
| 1670 | desc = TransposeDescriptor(permutationVector); |
| 1671 | } |
| 1672 | TensorInfo inputTensorInfo = InputTensorInfo(subgraphIndex, operatorIndex, 0); |
| 1673 | |
| 1674 | IConnectableLayer* layer = m_Network->AddTransposeLayer(desc, layerName.c_str()); |
| 1675 | |
| 1676 | if (!layer) |
| 1677 | { |
| 1678 | throw NullPointerException(fmt::format("Layer {} pointer is null {}", |
| 1679 | operatorIndex, CHECK_LOCATION().AsString())); |
| 1680 | } |
| 1681 | |
| 1682 | TensorInfo outputTensorInfo = OutputTensorInfoFromInputs(subgraphIndex, operatorIndex, layer, 0, {0}); |
| 1683 | CheckMatchingQuantization(inputTensorInfo, outputTensorInfo, layerName, "Input 0", "Output 0"); |
| 1684 | layer->GetOutputSlot(0).SetTensorInfo(outputTensorInfo); |
| 1685 | |
| 1686 | auto inputTensorIndexes = AsUnsignedVector(GetInputTensorIds(m_Model, subgraphIndex, operatorIndex)); |
| 1687 | RegisterInputSlots(subgraphIndex, operatorIndex, layer, {inputTensorIndexes[0]}); |
| 1688 | |
| 1689 | auto outputTensorIndexes = AsUnsignedVector(GetOutputTensorIds(m_Model, subgraphIndex, operatorIndex)); |
| 1690 | RegisterOutputSlots(subgraphIndex, operatorIndex, layer, {outputTensorIndexes[0]}); |
| 1691 | } |
| 1692 | |
| 1693 | void TfLiteParserImpl::ParseTransposeConv(size_t subgraphIndex, size_t operatorIndex) |
| 1694 | { |
nothing calls this directly
no test coverage detected