26 using LayerList = std::list<Layer*>;
27 using Iterator = LayerList::const_iterator;
29 const TensorInfo OverrideDataType(
const TensorInfo& info, Optional<DataType> type)
36 return TensorInfo(
info.GetShape(),
38 info.GetQuantizationScale(),
39 info.GetQuantizationOffset(),
52 switch(weightsType.
value())
64 ARMNN_ASSERT_MSG(
false,
"GetBiasTypeFromWeightsType(): Unsupported data type.");
70 bool IWorkloadFactory::IsLayerConfigurationSupported(
const BackendId& backendId,
71 const IConnectableLayer& connectableLayer,
72 Optional<DataType> dataType,
73 std::string& outReasonIfUnsupported,
76 Optional<std::string&> reason = outReasonIfUnsupported;
78 const Layer& layer = *(PolymorphicDowncast<const Layer*>(&connectableLayer));
81 if (!backendRegistry.IsBackendRegistered(backendId))
84 ss << connectableLayer.GetName() <<
" is not supported on " << backendId
85 <<
" because this backend is not registered.";
87 outReasonIfUnsupported = ss.str();
91 auto backendFactory = backendRegistry.GetFactory(backendId);
92 auto backendObject = backendFactory();
93 auto layerSupport = backendObject->GetLayerSupport(modelOptions);
94 auto layerSupportObject = LayerSupportHandle(layerSupport, backendId);
96 switch(layer.GetType())
100 auto cLayer = PolymorphicDowncast<const ActivationLayer*>(&layer);
101 const TensorInfo& input = layer.GetInputSlot(0).GetTensorInfo();
102 const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo();
103 result = layerSupportObject.IsActivationSupported(
104 OverrideDataType(input, dataType),
105 OverrideDataType(output, dataType),
106 cLayer->GetParameters(),
113 const TensorInfo& input0 = layer.GetInputSlot(0).GetTensorInfo();
114 const TensorInfo& input1 = layer.GetInputSlot(1).GetTensorInfo();
115 const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo();
116 result = layerSupportObject.IsAdditionSupported(
117 OverrideDataType(input0, dataType),
118 OverrideDataType(input1, dataType),
119 OverrideDataType(output, dataType),
126 auto cLayer = PolymorphicDowncast<const ArgMinMaxLayer*>(&layer);
127 const ArgMinMaxDescriptor& descriptor = cLayer->GetParameters();
129 const TensorInfo& input = layer.GetInputSlot(0).GetTensorInfo();
130 const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo();
131 result = layerSupportObject.IsArgMinMaxSupported(
132 OverrideDataType(input, dataType),
140 auto cLayer = PolymorphicDowncast<const BatchMatMulLayer*>(&layer);
141 const BatchMatMulDescriptor& descriptor = cLayer->GetParameters();
143 const TensorInfo& input0 = layer.GetInputSlot(0).GetTensorInfo();
144 const TensorInfo& input1 = layer.GetInputSlot(1).GetTensorInfo();
145 const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo();
146 result = layerSupportObject.IsBatchMatMulSupported(
147 OverrideDataType(input0, dataType),
148 OverrideDataType(input1, dataType),
149 OverrideDataType(output, dataType),
156 auto cLayer = PolymorphicDowncast<const BatchNormalizationLayer*>(&layer);
157 const TensorInfo& input = layer.GetInputSlot(0).GetTensorInfo();
158 const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo();
159 const TensorInfo& mean = cLayer->m_Mean->GetTensorInfo();
160 const TensorInfo& var = cLayer->m_Variance->GetTensorInfo();
161 const TensorInfo& beta = cLayer->m_Beta->GetTensorInfo();
162 const TensorInfo& gamma = cLayer->m_Gamma->GetTensorInfo();
163 result = layerSupportObject.IsBatchNormalizationSupported(
164 OverrideDataType(input, dataType),
165 OverrideDataType(output, dataType),
166 OverrideDataType(mean, dataType),
167 OverrideDataType(var, dataType),
168 OverrideDataType(beta, dataType),
169 OverrideDataType(gamma, dataType),
170 cLayer->GetParameters(),
176 const TensorInfo& input = layer.GetInputSlot(0).GetTensorInfo();
177 const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo();
178 auto cLayer = PolymorphicDowncast<const BatchToSpaceNdLayer*>(&layer);
180 result = layerSupportObject.IsBatchToSpaceNdSupported(OverrideDataType(input, dataType),
181 OverrideDataType(output, dataType),
182 cLayer->GetParameters(),
188 auto cLayer = PolymorphicDowncast<const BroadcastToLayer*>(&layer);
189 const TensorInfo& input = layer.GetInputSlot(0).GetConnection()->GetTensorInfo();
190 const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo();
192 result = layerSupportObject.IsBroadcastToSupported(OverrideDataType(input, dataType),
193 OverrideDataType(output, dataType),
194 cLayer->GetParameters(),
200 const TensorInfo& input = layer.GetInputSlot(0).GetTensorInfo();
201 const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo();
203 result = layerSupportObject.IsCastSupported(OverrideDataType(input, dataType),
204 OverrideDataType(output, dataType),
210 auto cLayer = PolymorphicDowncast<const ChannelShuffleLayer*>(&layer);
212 const TensorInfo& input = layer.GetInputSlot(0).GetTensorInfo();
213 const TensorInfo& output = layer.GetInputSlot(0).GetTensorInfo();
215 const ChannelShuffleDescriptor descriptor = cLayer->GetParameters();
217 result = layerSupportObject.IsChannelShuffleSupported(OverrideDataType(input, dataType),
218 OverrideDataType(output, dataType),
225 auto cLayer = PolymorphicDowncast<const ComparisonLayer*>(&layer);
227 const TensorInfo& input0 = layer.GetInputSlot(0).GetTensorInfo();
228 const TensorInfo& input1 = layer.GetInputSlot(1).GetTensorInfo();
229 const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo();
231 result = layerSupportObject.IsComparisonSupported(OverrideDataType(input0, dataType),
232 OverrideDataType(input1, dataType),
234 cLayer->GetParameters(),
240 const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo();
241 result = layerSupportObject.IsConstantSupported(OverrideDataType(output, dataType), reason);
246 const TensorInfo& input = layer.GetInputSlot(0).GetTensorInfo();
247 const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo();
248 result = layerSupportObject.IsConvertFp16ToFp32Supported(input, output, reason);
253 const TensorInfo& input = layer.GetInputSlot(0).GetTensorInfo();
254 const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo();
255 result = layerSupportObject.IsConvertFp32ToFp16Supported(input, output, reason);
260 auto cLayer = PolymorphicDowncast<const Convolution2dLayer*>(&layer);
262 const TensorInfo input = OverrideDataType(layer.GetInputSlot(0).GetTensorInfo(),
264 const TensorInfo output = OverrideDataType(layer.GetOutputSlot(0).GetTensorInfo(), dataType);
266 "Convolution2dLayer: Weights should be connected as a Constant Layer.");
267 const TensorInfo weights = OverrideDataType(layer.GetInputSlot(1).GetTensorInfo(),
270 const Convolution2dDescriptor& descriptor = cLayer->GetParameters();
273 Optional<TensorInfo> biases;
274 if (descriptor.m_BiasEnabled)
277 "Convolution2dLayer: Bias should be connected as a Constant Layer.");
278 biases = OverrideDataType(layer.GetInputSlot(2).GetTensorInfo(),
282 result = layerSupportObject.IsConvolution2dSupported(
293 auto cLayer = PolymorphicDowncast<const Convolution3dLayer*>(&layer);
295 const TensorInfo input = OverrideDataType(layer.GetInputSlot(0).GetTensorInfo(),
297 const TensorInfo output = OverrideDataType(layer.GetOutputSlot(0).GetTensorInfo(), dataType);
300 "Convolution3dLayer: Weights should be connected as a Constant Layer.");
301 const TensorInfo weights = OverrideDataType(layer.GetInputSlot(1).GetTensorInfo(),
304 const Convolution3dDescriptor& descriptor = cLayer->GetParameters();
307 Optional<TensorInfo> biases;
308 if (descriptor.m_BiasEnabled)
310 biases = OverrideDataType(layer.GetInputSlot(2).GetTensorInfo(),
314 result = layerSupportObject.IsConvolution3dSupported(
325 const TensorInfo& input = layer.GetInputSlot(0).GetTensorInfo();
326 const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo();
328 result = layerSupportObject.IsDebugSupported(OverrideDataType(input, dataType),
329 OverrideDataType(output, dataType),
335 auto cLayer = PolymorphicDowncast<const DepthToSpaceLayer*>(&layer);
337 const TensorInfo& input = layer.GetInputSlot(0).GetTensorInfo();
338 const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo();
340 result = layerSupportObject.IsDepthToSpaceSupported(OverrideDataType(input, dataType),
341 OverrideDataType(output, dataType),
342 cLayer->GetParameters(),
348 auto cLayer = PolymorphicDowncast<const DepthwiseConvolution2dLayer*>(&layer);
349 const TensorInfo& input = OverrideDataType(layer.GetInputSlot(0).GetTensorInfo(),
351 const TensorInfo& output = OverrideDataType(layer.GetOutputSlot(0).GetTensorInfo(), dataType);
352 const TensorInfo& weights = OverrideDataType(layer.GetInputSlot(1).GetTensorInfo(),
355 ARMNN_ASSERT(cLayer->GetInputSlot(1).GetConnection() !=
nullptr);
357 const DepthwiseConvolution2dDescriptor& descriptor = cLayer->GetParameters();
360 Optional<TensorInfo> biases;
361 if (descriptor.m_BiasEnabled)
363 biases = OverrideDataType(cLayer->GetInputSlot(2).GetTensorInfo(),
367 result = layerSupportObject.IsDepthwiseConvolutionSupported(input,
377 const TensorInfo& input = layer.GetInputSlot(0).GetTensorInfo();
378 const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo();
380 result = layerSupportObject.IsDequantizeSupported(input,
381 OverrideDataType(output, dataType),
387 auto cLayer = PolymorphicDowncast<const DetectionPostProcessLayer*>(&layer);
388 const TensorInfo& boxEncodings = layer.GetInputSlot(0).GetTensorInfo();
389 const TensorInfo& scores = layer.GetInputSlot(1).GetTensorInfo();
390 const TensorInfo& anchors = cLayer->m_Anchors->GetTensorInfo();
392 const TensorInfo& detectionBoxes = layer.GetOutputSlot(0).GetTensorInfo();
393 const TensorInfo& detectionClasses = layer.GetOutputSlot(1).GetTensorInfo();
394 const TensorInfo& detectionScores = layer.GetOutputSlot(2).GetTensorInfo();
395 const TensorInfo& numDetections = layer.GetOutputSlot(3).GetTensorInfo();
397 const DetectionPostProcessDescriptor& descriptor = cLayer->GetParameters();
398 result = layerSupportObject.IsDetectionPostProcessSupported(boxEncodings,
411 auto cLayer = PolymorphicDowncast<const ElementwiseBinaryLayer*>(&layer);
413 const TensorInfo& input0 = layer.GetInputSlot(0).GetTensorInfo();
414 const TensorInfo& input1 = layer.GetInputSlot(1).GetTensorInfo();
415 const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo();
416 std::vector<TensorInfo> infos = { OverrideDataType(input0, dataType),
417 OverrideDataType(input1, dataType),
418 OverrideDataType(output, dataType) };
421 cLayer->GetParameters(),
429 auto cLayer = PolymorphicDowncast<const ElementwiseUnaryLayer*>(&layer);
431 const TensorInfo& input = layer.GetInputSlot(0).GetTensorInfo();
432 const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo();
434 result = layerSupportObject.IsElementwiseUnarySupported(OverrideDataType(input, dataType),
435 OverrideDataType(output, dataType),
436 cLayer->GetParameters(),
442 auto cLayer = PolymorphicDowncast<const FillLayer*>(&layer);
443 const TensorInfo& input = layer.GetInputSlot(0).GetTensorInfo();
444 const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo();
445 const FillDescriptor& descriptor = cLayer->GetParameters();
447 result = layerSupportObject.IsFillSupported(
448 OverrideDataType(input, dataType),
449 OverrideDataType(output, dataType),
456 auto cLayer = PolymorphicDowncast<const FakeQuantizationLayer*>(&layer);
457 const TensorInfo& input = layer.GetInputSlot(0).GetTensorInfo();
458 result = layerSupportObject.IsFakeQuantizationSupported(OverrideDataType(input, dataType),
459 cLayer->GetParameters(),
465 const TensorInfo& input = layer.GetInputSlot(0).GetTensorInfo();
466 const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo();
467 result = layerSupportObject.IsFloorSupported(OverrideDataType(input, dataType),
468 OverrideDataType(output, dataType),
474 auto cLayer = PolymorphicDowncast<const FullyConnectedLayer*>(&layer);
475 const TensorInfo& input = layer.GetInputSlot(0).GetTensorInfo();
476 const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo();
478 const FullyConnectedDescriptor& descriptor = cLayer->GetParameters();
479 TensorInfo weightsInfo;
480 const TensorInfo* weightsInfoPtr =
nullptr;
482 weightsInfo = OverrideDataType(layer.GetInputSlot(1).GetTensorInfo(), dataType);
483 weightsInfoPtr = &weightsInfo;
486 const TensorInfo* biasInfoPtr =
nullptr;
487 static const TensorInfo dummyBFloat16Bias(TensorShape({1,1,1,1}),
DataType::BFloat16);
488 static const TensorInfo dummyFloat16Bias(TensorShape({1,1,1,1}),
DataType::Float16);
489 static const TensorInfo dummyFloat32Bias(TensorShape({1,1,1,1}),
DataType::Float32);
492 if (descriptor.m_BiasEnabled)
494 biasInfo = OverrideDataType(layer.GetInputSlot(2).GetTensorInfo(), dataType);
495 biasInfoPtr = &biasInfo;
500 switch(input.GetDataType())
504 biasInfoPtr = &dummyBFloat16Bias;
509 biasInfoPtr = &dummyFloat16Bias;
514 biasInfoPtr = &dummyFloat32Bias;
522 biasInfoPtr = &dummyQA8Bias;
531 result = layerSupportObject.IsFullyConnectedSupported(
532 OverrideDataType(input, dataType),
533 OverrideDataType(output, dataType),
542 auto cLayer = PolymorphicDowncast<const FusedLayer*>(&layer);
545 auto getOutTensorInfo = [&dataType](
const OutputSlot& slot)
547 return OverrideDataType(slot.GetTensorInfo(), dataType);
551 std::vector<TensorInfo> outputs(beginOutputs, endOutputs);
552 const std::vector<std::reference_wrapper<TensorInfo>> outputPtrs(outputs.begin(), outputs.end());
555 auto getInputTensorInfo = [&dataType](
const InputSlot& slot)
557 return OverrideDataType(slot.GetTensorInfo(), dataType);
561 std::vector<TensorInfo> inputs(beginInputs, endInputs);
562 const std::vector<std::reference_wrapper<TensorInfo>> inputPtrs(inputs.begin(), inputs.end());
564 result = layerSupportObject.IsFusedSupported(inputPtrs,
566 cLayer->GetParameters(),
572 const TensorInfo& input0 = layer.GetInputSlot(0).GetTensorInfo();
573 const TensorInfo& input1 = layer.GetInputSlot(1).GetTensorInfo();
574 const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo();
575 auto cLayer = PolymorphicDowncast<const GatherLayer*>(&layer);
576 const GatherDescriptor& descriptor = cLayer->GetParameters();
577 result = layerSupportObject.IsGatherSupported(OverrideDataType(input0, dataType),
579 OverrideDataType(output, dataType),
586 const TensorInfo& input0 = layer.GetInputSlot(0).GetTensorInfo();
587 const TensorInfo& input1 = layer.GetInputSlot(1).GetTensorInfo();
588 const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo();
589 result = layerSupportObject.IsGatherNdSupported(OverrideDataType(input0, dataType),
591 OverrideDataType(output, dataType),
597 const TensorInfo& input = layer.GetOutputSlot(0).GetTensorInfo();
598 result = layerSupportObject.IsInputSupported(OverrideDataType(input, dataType), reason);
603 auto cLayer = PolymorphicDowncast<const InstanceNormalizationLayer*>(&layer);
604 const InstanceNormalizationDescriptor& descriptor = cLayer->GetParameters();
606 const TensorInfo& input = layer.GetInputSlot(0).GetTensorInfo();
607 const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo();
609 result = layerSupportObject.IsInstanceNormalizationSupported(
610 OverrideDataType(input, dataType),
611 OverrideDataType(output, dataType),
618 auto cLayer = PolymorphicDowncast<const L2NormalizationLayer*>(&layer);
619 const L2NormalizationDescriptor& descriptor = cLayer->GetParameters();
621 const TensorInfo& input = layer.GetInputSlot(0).GetTensorInfo();
622 const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo();
624 result = layerSupportObject.IsL2NormalizationSupported(
625 OverrideDataType(input, dataType),
626 OverrideDataType(output, dataType),
633 auto cLayer = PolymorphicDowncast<const LogicalBinaryLayer*>(&layer);
635 const TensorInfo& input0 = layer.GetInputSlot(0).GetTensorInfo();
636 const TensorInfo& input1 = layer.GetInputSlot(1).GetTensorInfo();
637 const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo();
639 result = layerSupportObject.IsLogicalBinarySupported(input0,
642 cLayer->GetParameters(),
648 auto cLayer = PolymorphicDowncast<const LogSoftmaxLayer*>(&layer);
650 const TensorInfo& input = layer.GetInputSlot(0).GetTensorInfo();
651 const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo();
653 result = layerSupportObject.IsLogSoftmaxSupported(OverrideDataType(input, dataType),
654 OverrideDataType(output, dataType),
655 cLayer->GetParameters(),
661 auto cLayer = PolymorphicDowncast<const LstmLayer*>(&layer);
662 const LstmDescriptor& descriptor = cLayer->GetParameters();
665 const TensorInfo& input = OverrideDataType(layer.GetInputSlot(0).GetTensorInfo(),
667 const TensorInfo& outputStateIn = OverrideDataType(layer.GetInputSlot(1).GetTensorInfo(),
669 const TensorInfo& cellStateIn = OverrideDataType(layer.GetInputSlot(2).GetTensorInfo(),
672 const TensorInfo& scratchBuffer = OverrideDataType(layer.GetOutputSlot(0).GetTensorInfo(), dataType);
673 const TensorInfo& outputStateOut = OverrideDataType(layer.GetOutputSlot(1).GetTensorInfo(), dataType);
674 const TensorInfo& cellStateOut = OverrideDataType(layer.GetOutputSlot(2).GetTensorInfo(), dataType);
675 const TensorInfo& output = OverrideDataType(layer.GetOutputSlot(3).GetTensorInfo(), dataType);
678 const TensorInfo& inputToForgetWeights
679 = OverrideDataType(cLayer->m_BasicParameters.m_InputToForgetWeights->GetTensorInfo(), dataType);
680 const TensorInfo& inputToCellWeights
681 = OverrideDataType(cLayer->m_BasicParameters.m_InputToCellWeights->GetTensorInfo(), dataType);
682 const TensorInfo& inputToOutputWeights
683 = OverrideDataType(cLayer->m_BasicParameters.m_InputToOutputWeights->GetTensorInfo(), dataType);
684 const TensorInfo& recurrentToForgetWeights
685 = OverrideDataType(cLayer->m_BasicParameters.m_RecurrentToForgetWeights->GetTensorInfo(), dataType);
686 const TensorInfo& recurrentToCellWeights
687 = OverrideDataType(cLayer->m_BasicParameters.m_RecurrentToCellWeights->GetTensorInfo(), dataType);
688 const TensorInfo& recurrentToOutputWeights
689 = OverrideDataType(cLayer->m_BasicParameters.m_RecurrentToOutputWeights->GetTensorInfo(), dataType);
690 const TensorInfo& forgetGateBias
691 = OverrideDataType(cLayer->m_BasicParameters.m_ForgetGateBias->GetTensorInfo(), dataType);
692 const TensorInfo& cellBias
693 = OverrideDataType(cLayer->m_BasicParameters.m_CellBias->GetTensorInfo(), dataType);
694 const TensorInfo& outputGateBias
695 = OverrideDataType(cLayer->m_BasicParameters.m_OutputGateBias->GetTensorInfo(), dataType);
697 LstmInputParamsInfo paramsInfo;
699 paramsInfo.m_InputToForgetWeights = &inputToForgetWeights;
700 paramsInfo.m_InputToCellWeights = &inputToCellWeights;
701 paramsInfo.m_InputToOutputWeights = &inputToOutputWeights;
702 paramsInfo.m_RecurrentToForgetWeights = &recurrentToForgetWeights;
703 paramsInfo.m_RecurrentToCellWeights = &recurrentToCellWeights;
704 paramsInfo.m_RecurrentToOutputWeights = &recurrentToOutputWeights;
705 paramsInfo.m_ForgetGateBias = &forgetGateBias;
706 paramsInfo.m_CellBias = &cellBias;
707 paramsInfo.m_OutputGateBias = &outputGateBias;
711 TensorInfo optInputToInputWeights;
712 TensorInfo optRecurrentToInputWeights;
713 TensorInfo optCellToInputWeights;
714 TensorInfo optInputGateBias;
715 TensorInfo optProjectionWeights;
716 TensorInfo optProjectionBias;
717 TensorInfo optCellToForgetWeights;
718 TensorInfo optCellToOutputWeights;
719 TensorInfo optInputLayerNormWeights;
720 TensorInfo optForgetLayerNormWeights;
721 TensorInfo optCellLayerNormWeights;
722 TensorInfo optOutputLayerNormWeights;
724 if(!descriptor.m_CifgEnabled)
726 optInputToInputWeights =
727 OverrideDataType(cLayer->m_CifgParameters.m_InputToInputWeights->GetTensorInfo(), dataType);
728 paramsInfo.m_InputToInputWeights = &optInputToInputWeights;
730 optRecurrentToInputWeights =
731 OverrideDataType(cLayer->m_CifgParameters.m_RecurrentToInputWeights->GetTensorInfo(), dataType);
732 paramsInfo.m_RecurrentToInputWeights = &optRecurrentToInputWeights;
734 OverrideDataType(cLayer->m_CifgParameters.m_InputGateBias->GetTensorInfo(), dataType);
735 paramsInfo.m_InputGateBias = &optInputGateBias;
738 if(descriptor.m_ProjectionEnabled)
740 optProjectionWeights =
741 OverrideDataType(cLayer->m_ProjectionParameters.m_ProjectionWeights->GetTensorInfo(), dataType);
742 paramsInfo.m_ProjectionWeights = &optProjectionWeights;
743 if (cLayer->m_ProjectionParameters.m_ProjectionBias !=
nullptr)
746 OverrideDataType(cLayer->m_ProjectionParameters.m_ProjectionBias->GetTensorInfo(), dataType);
747 paramsInfo.m_ProjectionBias = &optProjectionBias;
751 if(descriptor.m_PeepholeEnabled)
753 if(!descriptor.m_CifgEnabled)
755 optCellToInputWeights =
756 OverrideDataType(cLayer->m_PeepholeParameters.m_CellToInputWeights->GetTensorInfo(),
758 paramsInfo.m_CellToInputWeights = &optCellToInputWeights;
760 optCellToForgetWeights =
761 OverrideDataType(cLayer->m_PeepholeParameters.m_CellToForgetWeights->GetTensorInfo(), dataType);
762 paramsInfo.m_CellToForgetWeights = &optCellToForgetWeights;
763 optCellToOutputWeights =
764 OverrideDataType(cLayer->m_PeepholeParameters.m_CellToOutputWeights->GetTensorInfo(), dataType);
765 paramsInfo.m_CellToOutputWeights = &optCellToOutputWeights;
768 if(descriptor.m_LayerNormEnabled)
770 if (!descriptor.m_CifgEnabled)
772 optInputLayerNormWeights = OverrideDataType(
773 cLayer->m_LayerNormParameters.m_InputLayerNormWeights->GetTensorInfo(), dataType);
774 paramsInfo.m_InputLayerNormWeights = &optInputLayerNormWeights;
777 optForgetLayerNormWeights = OverrideDataType(
778 cLayer->m_LayerNormParameters.m_ForgetLayerNormWeights->GetTensorInfo(), dataType);
779 paramsInfo.m_ForgetLayerNormWeights = &optForgetLayerNormWeights;
781 optCellLayerNormWeights = OverrideDataType(
782 cLayer->m_LayerNormParameters.m_CellLayerNormWeights->GetTensorInfo(), dataType);
783 paramsInfo.m_CellLayerNormWeights = &optCellLayerNormWeights;
785 optOutputLayerNormWeights = OverrideDataType(
786 cLayer->m_LayerNormParameters.m_OutputLayerNormWeights->GetTensorInfo(), dataType);
787 paramsInfo.m_OutputLayerNormWeights = &optOutputLayerNormWeights;
790 result = layerSupportObject.IsLstmSupported(
806 const TensorInfo& input0 = layer.GetInputSlot(0).GetTensorInfo();
807 const TensorInfo& input1 = layer.GetInputSlot(1).GetTensorInfo();
808 const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo();
810 result = layerSupportObject.IsMaximumSupported(OverrideDataType(input0, dataType),
811 OverrideDataType(input1, dataType),
812 OverrideDataType(output, dataType),
819 const TensorInfo& input = layer.GetInputSlot(0).GetTensorInfo();
820 const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo();
822 result = layerSupportObject.IsMemCopySupported(OverrideDataType(input, dataType),
823 OverrideDataType(output, dataType),
829 const TensorInfo& input = layer.GetInputSlot(0).GetTensorInfo();
830 const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo();
832 result = layerSupportObject.IsMemImportSupported(OverrideDataType(input, dataType),
833 OverrideDataType(output, dataType),
839 const TensorInfo& input0 = layer.GetInputSlot(0).GetTensorInfo();
840 const TensorInfo& input1 = layer.GetInputSlot(1).GetTensorInfo();
841 const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo();
843 result = layerSupportObject.IsMergeSupported(OverrideDataType(input0, dataType),
844 OverrideDataType(input1, dataType),
845 OverrideDataType(output, dataType),
851 auto cLayer = PolymorphicDowncast<const ConcatLayer*>(&layer);
854 auto getTensorInfo = [&dataType](
const InputSlot& slot)
856 return OverrideDataType(slot.GetConnectedOutputSlot()->GetTensorInfo(), dataType);
861 std::vector<TensorInfo> inputs(beginI, endI);
863 auto getTensorInfoPtr = [](
const TensorInfo&
info)
870 std::vector<const TensorInfo*> inputPtrs(beginPtr, endPtr);
872 const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo();
874 result = layerSupportObject.IsConcatSupported(inputPtrs, output, cLayer->GetParameters(), reason);
882 const TensorInfo& input0 = layer.GetInputSlot(0).GetTensorInfo();
883 const TensorInfo& input1 = layer.GetInputSlot(1).GetTensorInfo();
884 const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo();
885 result = layerSupportObject.IsMultiplicationSupported(
886 OverrideDataType(input0, dataType),
887 OverrideDataType(input1, dataType),
888 OverrideDataType(output, dataType),
895 auto cLayer = PolymorphicDowncast<const NormalizationLayer*>(&layer);
896 const TensorInfo& input = layer.GetInputSlot(0).GetTensorInfo();
897 const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo();
898 result = layerSupportObject.IsNormalizationSupported(OverrideDataType(input, dataType),
899 OverrideDataType(output, dataType),
900 cLayer->GetParameters(),
906 const TensorInfo& output = layer.GetInputSlot(0).GetTensorInfo();
907 result = layerSupportObject.IsOutputSupported(OverrideDataType(output, dataType), reason);
912 auto cLayer = PolymorphicDowncast<const PermuteLayer*>(&layer);
913 const TensorInfo& input = layer.GetInputSlot(0).GetTensorInfo();
914 const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo();
915 result = layerSupportObject.IsPermuteSupported(OverrideDataType(input, dataType),
916 OverrideDataType(output, dataType),
917 cLayer->GetParameters(),
923 auto cLayer = PolymorphicDowncast<const PadLayer*>(&layer);
924 const TensorInfo& input = layer.GetInputSlot(0).GetTensorInfo();
925 const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo();
926 result = layerSupportObject.IsPadSupported(
927 OverrideDataType(input, dataType),
928 OverrideDataType(output, dataType),
929 cLayer->GetParameters(),
935 auto cLayer = PolymorphicDowncast<const Pooling2dLayer*>(&layer);
936 const TensorInfo& input = layer.GetInputSlot(0).GetTensorInfo();
937 const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo();
938 result = layerSupportObject.IsPooling2dSupported(OverrideDataType(input, dataType),
939 OverrideDataType(output, dataType),
940 cLayer->GetParameters(),
946 auto cLayer = PolymorphicDowncast<const Pooling3dLayer*>(&layer);
947 const TensorInfo& input = layer.GetInputSlot(0).GetTensorInfo();
948 const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo();
949 result = layerSupportObject.IsPooling3dSupported(OverrideDataType(input, dataType),
950 OverrideDataType(output, dataType),
951 cLayer->GetParameters(),
957 auto cLayer = PolymorphicDowncast<const PreCompiledLayer*>(&layer);
958 const TensorInfo& input = layer.GetInputSlot(0).GetTensorInfo();
959 result = layerSupportObject.IsPreCompiledSupported(OverrideDataType(input, dataType),
960 cLayer->GetParameters(),
966 const TensorInfo& input = layer.GetInputSlot(0).GetTensorInfo();
967 const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo();
968 result = layerSupportObject.IsQuantizeSupported(input, output, reason);
973 auto cLayer = PolymorphicDowncast<const QLstmLayer*>(&layer);
974 const QLstmDescriptor& descriptor = cLayer->GetParameters();
977 const TensorInfo& input = layer.GetInputSlot(0).GetTensorInfo();
978 const TensorInfo& previousOutputIn = layer.GetInputSlot(1).GetTensorInfo();
979 const TensorInfo& previousCellStateIn = layer.GetInputSlot(2).GetTensorInfo();
982 const TensorInfo& outputStateOut = layer.GetOutputSlot(0).GetTensorInfo();
983 const TensorInfo& cellStateOut = layer.GetOutputSlot(1).GetTensorInfo();
984 const TensorInfo& output = layer.GetOutputSlot(2).GetTensorInfo();
987 LstmInputParamsInfo paramsInfo;
990 ARMNN_ASSERT(cLayer->m_BasicParameters.m_InputToForgetWeights.get() !=
nullptr);
991 ARMNN_ASSERT(cLayer->m_BasicParameters.m_InputToCellWeights.get() !=
nullptr);
992 ARMNN_ASSERT(cLayer->m_BasicParameters.m_InputToOutputWeights.get() !=
nullptr);
993 paramsInfo.m_InputToForgetWeights = &cLayer->m_BasicParameters.m_InputToForgetWeights->GetTensorInfo();
994 paramsInfo.m_InputToCellWeights = &cLayer->m_BasicParameters.m_InputToCellWeights->GetTensorInfo();
995 paramsInfo.m_InputToOutputWeights = &cLayer->m_BasicParameters.m_InputToOutputWeights->GetTensorInfo();
997 paramsInfo.m_RecurrentToForgetWeights =
998 &cLayer->m_BasicParameters.m_RecurrentToForgetWeights->GetTensorInfo();
999 paramsInfo.m_RecurrentToCellWeights =
1000 &cLayer->m_BasicParameters.m_RecurrentToCellWeights->GetTensorInfo();
1001 paramsInfo.m_RecurrentToOutputWeights =
1002 &cLayer->m_BasicParameters.m_RecurrentToOutputWeights->GetTensorInfo();
1004 paramsInfo.m_ForgetGateBias = &cLayer->m_BasicParameters.m_ForgetGateBias->GetTensorInfo();
1005 paramsInfo.m_CellBias = &cLayer->m_BasicParameters.m_CellBias->GetTensorInfo();
1006 paramsInfo.m_OutputGateBias = &cLayer->m_BasicParameters.m_OutputGateBias->GetTensorInfo();
1008 if(!descriptor.m_CifgEnabled)
1010 paramsInfo.m_InputToInputWeights = &cLayer->m_CifgParameters.m_InputToInputWeights->GetTensorInfo();
1011 paramsInfo.m_RecurrentToInputWeights =
1012 &cLayer->m_CifgParameters.m_RecurrentToInputWeights->GetTensorInfo();
1013 paramsInfo.m_InputGateBias = &cLayer->m_CifgParameters.m_InputGateBias->GetTensorInfo();
1016 if(descriptor.m_ProjectionEnabled)
1018 paramsInfo.m_ProjectionWeights = &cLayer->m_ProjectionParameters.m_ProjectionWeights->GetTensorInfo();
1021 if (cLayer->m_ProjectionParameters.m_ProjectionBias !=
nullptr)
1023 paramsInfo.m_ProjectionBias = &cLayer->m_ProjectionParameters.m_ProjectionBias->GetTensorInfo();
1027 if(descriptor.m_PeepholeEnabled)
1029 if (!descriptor.m_CifgEnabled)
1031 paramsInfo.m_CellToInputWeights =
1032 &cLayer->m_PeepholeParameters.m_CellToInputWeights->GetTensorInfo();
1035 paramsInfo.m_CellToForgetWeights =
1036 &cLayer->m_PeepholeParameters.m_CellToForgetWeights->GetTensorInfo();
1037 paramsInfo.m_CellToOutputWeights = &cLayer->m_PeepholeParameters.m_CellToOutputWeights->GetTensorInfo();
1040 if(descriptor.m_LayerNormEnabled)
1042 if (!descriptor.m_CifgEnabled)
1044 paramsInfo.m_InputLayerNormWeights =
1045 &cLayer->m_LayerNormParameters.m_InputLayerNormWeights->GetTensorInfo();
1048 paramsInfo.m_ForgetLayerNormWeights =
1049 &cLayer->m_LayerNormParameters.m_ForgetLayerNormWeights->GetTensorInfo();
1050 paramsInfo.m_CellLayerNormWeights =
1051 &cLayer->m_LayerNormParameters.m_CellLayerNormWeights->GetTensorInfo();
1052 paramsInfo.m_OutputLayerNormWeights =
1053 &cLayer->m_LayerNormParameters.m_OutputLayerNormWeights->GetTensorInfo();
1056 result = layerSupportObject.IsQLstmSupported(input,
1058 previousCellStateIn,
1069 auto cLayer = PolymorphicDowncast<const QuantizedLstmLayer*>(&layer);
1072 const TensorInfo& input = layer.GetInputSlot(0).GetTensorInfo();
1073 const TensorInfo& previousCellStateIn = layer.GetInputSlot(1).GetTensorInfo();
1074 const TensorInfo& previousOutputIn = layer.GetInputSlot(2).GetTensorInfo();
1077 const TensorInfo& cellStateOut = layer.GetOutputSlot(0).GetTensorInfo();
1078 const TensorInfo& output = layer.GetOutputSlot(1).GetTensorInfo();
1081 QuantizedLstmInputParamsInfo paramsInfo;
1083 paramsInfo.m_InputToInputWeights =
1084 &cLayer->m_QuantizedLstmParameters.m_InputToInputWeights->GetTensorInfo();
1085 paramsInfo.m_InputToForgetWeights =
1086 &cLayer->m_QuantizedLstmParameters.m_InputToForgetWeights->GetTensorInfo();
1087 paramsInfo.m_InputToCellWeights =
1088 &cLayer->m_QuantizedLstmParameters.m_InputToCellWeights->GetTensorInfo();
1089 paramsInfo.m_InputToOutputWeights =
1090 &cLayer->m_QuantizedLstmParameters.m_InputToOutputWeights->GetTensorInfo();
1092 paramsInfo.m_RecurrentToInputWeights =
1093 &cLayer->m_QuantizedLstmParameters.m_RecurrentToInputWeights->GetTensorInfo();
1094 paramsInfo.m_RecurrentToForgetWeights =
1095 &cLayer->m_QuantizedLstmParameters.m_RecurrentToForgetWeights->GetTensorInfo();
1096 paramsInfo.m_RecurrentToCellWeights =
1097 &cLayer->m_QuantizedLstmParameters.m_RecurrentToCellWeights->GetTensorInfo();
1098 paramsInfo.m_RecurrentToOutputWeights =
1099 &cLayer->m_QuantizedLstmParameters.m_RecurrentToOutputWeights->GetTensorInfo();
1101 paramsInfo.m_InputGateBias =
1102 &cLayer->m_QuantizedLstmParameters.m_InputGateBias->GetTensorInfo();
1103 paramsInfo.m_ForgetGateBias =
1104 &cLayer->m_QuantizedLstmParameters.m_ForgetGateBias->GetTensorInfo();
1105 paramsInfo.m_CellBias =
1106 &cLayer->m_QuantizedLstmParameters.m_CellBias->GetTensorInfo();
1107 paramsInfo.m_OutputGateBias =
1108 &cLayer->m_QuantizedLstmParameters.m_OutputGateBias->GetTensorInfo();;
1110 result = layerSupportObject.IsQuantizedLstmSupported(input,
1111 previousCellStateIn,
1122 const TensorInfo& input0 = layer.GetInputSlot(0).GetTensorInfo();
1123 const TensorInfo& input1 = layer.GetInputSlot(1).GetTensorInfo();
1124 const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo();
1125 result = layerSupportObject.IsDivisionSupported(
1126 OverrideDataType(input0, dataType),
1127 OverrideDataType(input1, dataType),
1128 OverrideDataType(output, dataType),
1135 const TensorInfo& input = layer.GetInputSlot(0).GetTensorInfo();
1136 const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo();
1137 result = layerSupportObject.IsRankSupported(OverrideDataType(input, dataType),
1138 OverrideDataType(output, dataType),
1144 auto cLayer = PolymorphicDowncast<const ReshapeLayer*>(&layer);
1145 const TensorInfo& input = layer.GetInputSlot(0).GetTensorInfo();
1146 const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo();
1147 result = layerSupportObject.IsReshapeSupported(OverrideDataType(input, dataType),
1148 OverrideDataType(output, dataType),
1149 cLayer->GetParameters(),
1155 auto cLayer = PolymorphicDowncast<const ResizeLayer*>(&layer);
1156 const TensorInfo& input = layer.GetInputSlot(0).GetTensorInfo();
1157 const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo();
1158 result = layerSupportObject.IsResizeSupported(OverrideDataType(input, dataType),
1159 OverrideDataType(output, dataType),
1160 cLayer->GetParameters(),
1166 const TensorInfo& input0 = layer.GetInputSlot(0).GetConnection()->GetTensorInfo();
1167 const TensorInfo& input1 = layer.GetInputSlot(1).GetConnection()->GetTensorInfo();
1168 const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo();
1169 result = layerSupportObject.IsReverseV2Supported(OverrideDataType(input0, dataType),
1171 OverrideDataType(output, dataType),
1177 const TensorInfo& input = layer.GetInputSlot(0).GetTensorInfo();
1178 const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo();
1180 result = layerSupportObject.IsShapeSupported(OverrideDataType(input, dataType),
1181 OverrideDataType(output, dataType),
1187 auto cLayer = PolymorphicDowncast<const SliceLayer*>(&layer);
1189 const TensorInfo& input = layer.GetInputSlot(0).GetTensorInfo();
1190 const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo();
1192 result = layerSupportObject.IsSliceSupported(OverrideDataType(input, dataType),
1193 OverrideDataType(output, dataType),
1194 cLayer->GetParameters(),
1200 auto cLayer = PolymorphicDowncast<const SoftmaxLayer*>(&layer);
1201 const TensorInfo& input = layer.GetInputSlot(0).GetTensorInfo();
1202 const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo();
1203 result = layerSupportObject.IsSoftmaxSupported(OverrideDataType(input, dataType),
1204 OverrideDataType(output, dataType),
1205 cLayer->GetParameters(),
1211 auto cLayer = PolymorphicDowncast<const SpaceToBatchNdLayer*>(&layer);
1212 const TensorInfo& input = layer.GetInputSlot(0).GetTensorInfo();
1213 const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo();
1214 result = layerSupportObject.IsSpaceToBatchNdSupported(OverrideDataType(input, dataType),
1215 OverrideDataType(output, dataType),
1216 cLayer->GetParameters(),
1222 auto cLayer = PolymorphicDowncast<const SpaceToDepthLayer*>(&layer);
1224 const TensorInfo& input = layer.GetInputSlot(0).GetTensorInfo();
1225 const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo();
1227 result = layerSupportObject.IsSpaceToDepthSupported(OverrideDataType(input, dataType),
1228 OverrideDataType(output, dataType),
1229 cLayer->GetParameters(),
1235 auto cLayer = PolymorphicDowncast<const SplitterLayer*>(&layer);
1236 const TensorInfo& input = layer.GetInputSlot(0).GetTensorInfo();
1239 auto getTensorInfo = [&dataType](
const OutputSlot& slot)
1241 return OverrideDataType(slot.GetTensorInfo(), dataType);
1245 std::vector<TensorInfo> outputs(beginI, endI);
1247 const std::vector<std::reference_wrapper<TensorInfo>> outputPtrs(outputs.begin(), outputs.end());
1249 result = layerSupportObject.IsSplitterSupported(OverrideDataType(input, dataType),
1251 cLayer->GetParameters(),
1257 auto cLayer = PolymorphicDowncast<const StackLayer*>(&layer);
1260 auto getTensorInfo = [&dataType](
const InputSlot& slot)
1262 return OverrideDataType(slot.GetConnectedOutputSlot()->GetTensorInfo(), dataType);
1266 std::vector<TensorInfo> inputs(beginI, endI);
1268 auto getTensorInfoPtr = [](
const TensorInfo&
info)
1274 std::vector<const TensorInfo*> inputPtrs(beginPtr, endPtr);
1276 const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo();
1278 result = layerSupportObject.IsStackSupported(inputPtrs, output, cLayer->GetParameters(), reason);
1284 auto cLayer = PolymorphicDowncast<const StandInLayer*>(&layer);
1287 auto getTensorInfoIn = [&dataType](
const InputSlot& slot)
1289 return OverrideDataType(slot.GetConnectedOutputSlot()->GetTensorInfo(), dataType);
1291 auto getTensorInfoOut = [&dataType](
const OutputSlot& slot)
1293 return OverrideDataType(slot.GetTensorInfo(), dataType);
1297 std::vector<TensorInfo> inputs(beginI, endI);
1301 std::vector<TensorInfo> outputs(beginO, endO);
1304 auto getTensorInfoPtr = [](
const TensorInfo&
info)
1310 std::vector<const TensorInfo*> inputPtrs(beginPtrI, endPtrI);
1314 std::vector<const TensorInfo*> outputPtrs(beginPtrO, endPtrO);
1317 result = layerSupportObject.IsStandInSupported(inputPtrs,
1319 cLayer->GetParameters(),
1325 auto cLayer = PolymorphicDowncast<const StridedSliceLayer*>(&layer);
1326 const TensorInfo& input = layer.GetInputSlot(0).GetTensorInfo();
1327 const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo();
1328 result = layerSupportObject.IsStridedSliceSupported(OverrideDataType(input, dataType),
1329 OverrideDataType(output, dataType),
1330 cLayer->GetParameters(),
1337 const TensorInfo& input0 = layer.GetInputSlot(0).GetTensorInfo();
1338 const TensorInfo& input1 = layer.GetInputSlot(1).GetTensorInfo();
1339 const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo();
1340 result = layerSupportObject.IsSubtractionSupported(
1341 OverrideDataType(input0, dataType),
1342 OverrideDataType(input1, dataType),
1343 OverrideDataType(output, dataType),
1350 const TensorInfo& input0 = layer.GetInputSlot(0).GetTensorInfo();
1351 const TensorInfo& input1 = layer.GetInputSlot(1).GetTensorInfo();
1352 const TensorInfo& output0 = layer.GetOutputSlot(0).GetTensorInfo();
1353 const TensorInfo& output1 = layer.GetOutputSlot(1).GetTensorInfo();
1354 result = layerSupportObject.IsSwitchSupported(OverrideDataType(input0, dataType),
1355 OverrideDataType(input1, dataType),
1356 OverrideDataType(output0, dataType),
1357 OverrideDataType(output1, dataType),
1363 auto cLayer = PolymorphicDowncast<const MeanLayer*>(&layer);
1364 const TensorInfo& input = layer.GetInputSlot(0).GetTensorInfo();
1365 const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo();
1366 result = layerSupportObject.IsMeanSupported(
1367 OverrideDataType(input, dataType),
1368 OverrideDataType(output, dataType),
1369 cLayer->GetParameters(),
1376 const TensorInfo& input0 = layer.GetInputSlot(0).GetTensorInfo();
1377 const TensorInfo& input1 = layer.GetInputSlot(1).GetTensorInfo();
1378 const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo();
1379 result = layerSupportObject.IsMinimumSupported(OverrideDataType(input0, dataType),
1380 OverrideDataType(input1, dataType),
1381 OverrideDataType(output, dataType),
1388 const TensorInfo& input = layer.GetInputSlot(0).GetTensorInfo();
1389 const TensorInfo& alpha = layer.GetInputSlot(1).GetTensorInfo();
1390 const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo();
1391 result = layerSupportObject.IsPreluSupported(OverrideDataType(input, dataType),
1392 OverrideDataType(alpha, dataType),
1393 OverrideDataType(output, dataType),
1399 auto cLayer = PolymorphicDowncast<const TileLayer*>(&layer);
1400 const TensorInfo& input = layer.GetInputSlot(0).GetTensorInfo();
1401 const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo();
1403 result = layerSupportObject.IsTileSupported(OverrideDataType(input, dataType),
1404 OverrideDataType(output, dataType),
1405 cLayer->GetParameters(),
1412 auto cLayer = PolymorphicDowncast<const TransposeLayer*>(&layer);
1413 const TensorInfo& input = layer.GetInputSlot(0).GetTensorInfo();
1414 const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo();
1415 result = layerSupportObject.IsTransposeSupported(OverrideDataType(input, dataType),
1416 OverrideDataType(output, dataType),
1417 cLayer->GetParameters(),
1423 auto cLayer = PolymorphicDowncast<const TransposeConvolution2dLayer*>(&layer);
1425 const TensorInfo input = OverrideDataType(layer.GetInputSlot(0).GetTensorInfo(),
1427 const TensorInfo output = OverrideDataType(layer.GetOutputSlot(0).GetTensorInfo(), dataType);
1429 const TransposeConvolution2dDescriptor& descriptor = cLayer->GetParameters();
1431 Optional<TensorInfo> biases;
1432 if (descriptor.m_BiasEnabled)
1435 biases = OverrideDataType(cLayer->m_Bias->GetTensorInfo(),
1440 const TensorInfo weights = OverrideDataType(cLayer->m_Weight->GetTensorInfo(), dataType);
1442 result = layerSupportObject.IsTransposeConvolution2dSupported(input,
1453 auto cLayer = PolymorphicDowncast<const ReduceLayer*>(&layer);
1454 const TensorInfo& input = layer.GetInputSlot(0).GetTensorInfo();
1455 const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo();
1457 result = layerSupportObject.IsReduceSupported(OverrideDataType(input, dataType),
1458 OverrideDataType(output, dataType),
1459 cLayer->GetParameters(),
1465 auto cLayer = PolymorphicDowncast<const UnidirectionalSequenceLstmLayer*>(&layer);
1469 const TensorInfo& input = OverrideDataType(layer.GetInputSlot(0).GetTensorInfo(),
1471 const TensorInfo& outputStateIn = OverrideDataType(layer.GetInputSlot(1).GetTensorInfo(),
1473 const TensorInfo& cellStateIn = OverrideDataType(layer.GetInputSlot(2).GetTensorInfo(),
1476 const TensorInfo& outputStateOut = OverrideDataType(layer.GetOutputSlot(0).GetTensorInfo(), dataType);
1477 const TensorInfo& cellStateOut = OverrideDataType(layer.GetOutputSlot(1).GetTensorInfo(), dataType);
1478 const TensorInfo& output = OverrideDataType(layer.GetOutputSlot(2).GetTensorInfo(), dataType);
1481 const TensorInfo& inputToForgetWeights
1482 = OverrideDataType(cLayer->m_BasicParameters.m_InputToForgetWeights->GetTensorInfo(), dataType);
1483 const TensorInfo& inputToCellWeights
1484 = OverrideDataType(cLayer->m_BasicParameters.m_InputToCellWeights->GetTensorInfo(), dataType);
1485 const TensorInfo& inputToOutputWeights
1486 = OverrideDataType(cLayer->m_BasicParameters.m_InputToOutputWeights->GetTensorInfo(), dataType);
1487 const TensorInfo& recurrentToForgetWeights
1488 = OverrideDataType(cLayer->m_BasicParameters.m_RecurrentToForgetWeights->GetTensorInfo(), dataType);
1489 const TensorInfo& recurrentToCellWeights
1490 = OverrideDataType(cLayer->m_BasicParameters.m_RecurrentToCellWeights->GetTensorInfo(), dataType);
1491 const TensorInfo& recurrentToOutputWeights
1492 = OverrideDataType(cLayer->m_BasicParameters.m_RecurrentToOutputWeights->GetTensorInfo(), dataType);
1493 const TensorInfo& forgetGateBias
1494 = OverrideDataType(cLayer->m_BasicParameters.m_ForgetGateBias->GetTensorInfo(), dataType);
1495 const TensorInfo& cellBias
1496 = OverrideDataType(cLayer->m_BasicParameters.m_CellBias->GetTensorInfo(), dataType);
1497 const TensorInfo& outputGateBias
1498 = OverrideDataType(cLayer->m_BasicParameters.m_OutputGateBias->GetTensorInfo(), dataType);
1500 LstmInputParamsInfo paramsInfo;
1502 paramsInfo.m_InputToForgetWeights = &inputToForgetWeights;
1503 paramsInfo.m_InputToCellWeights = &inputToCellWeights;
1504 paramsInfo.m_InputToOutputWeights = &inputToOutputWeights;
1505 paramsInfo.m_RecurrentToForgetWeights = &recurrentToForgetWeights;
1506 paramsInfo.m_RecurrentToCellWeights = &recurrentToCellWeights;
1507 paramsInfo.m_RecurrentToOutputWeights = &recurrentToOutputWeights;
1508 paramsInfo.m_ForgetGateBias = &forgetGateBias;
1509 paramsInfo.m_CellBias = &cellBias;
1510 paramsInfo.m_OutputGateBias = &outputGateBias;
1513 TensorInfo optInputToInputWeights;
1514 TensorInfo optRecurrentToInputWeights;
1515 TensorInfo optCellToInputWeights;
1516 TensorInfo optInputGateBias;
1517 TensorInfo optProjectionWeights;
1518 TensorInfo optProjectionBias;
1519 TensorInfo optCellToForgetWeights;
1520 TensorInfo optCellToOutputWeights;
1521 TensorInfo optInputLayerNormWeights;
1522 TensorInfo optForgetLayerNormWeights;
1523 TensorInfo optCellLayerNormWeights;
1524 TensorInfo optOutputLayerNormWeights;
1526 if(!descriptor.m_CifgEnabled)
1528 optInputToInputWeights =
1529 OverrideDataType(cLayer->m_CifgParameters.m_InputToInputWeights->GetTensorInfo(), dataType);
1530 paramsInfo.m_InputToInputWeights = &optInputToInputWeights;
1532 optRecurrentToInputWeights =
1533 OverrideDataType(cLayer->m_CifgParameters.m_RecurrentToInputWeights->GetTensorInfo(), dataType);
1534 paramsInfo.m_RecurrentToInputWeights = &optRecurrentToInputWeights;
1536 OverrideDataType(cLayer->m_CifgParameters.m_InputGateBias->GetTensorInfo(), dataType);
1537 paramsInfo.m_InputGateBias = &optInputGateBias;
1540 if(descriptor.m_ProjectionEnabled)
1542 optProjectionWeights =
1543 OverrideDataType(cLayer->m_ProjectionParameters.m_ProjectionWeights->GetTensorInfo(), dataType);
1544 paramsInfo.m_ProjectionWeights = &optProjectionWeights;
1545 if (cLayer->m_ProjectionParameters.m_ProjectionBias !=
nullptr)
1548 OverrideDataType(cLayer->m_ProjectionParameters.m_ProjectionBias->GetTensorInfo(), dataType);
1549 paramsInfo.m_ProjectionBias = &optProjectionBias;
1553 if(descriptor.m_PeepholeEnabled)
1555 if(!descriptor.m_CifgEnabled)
1557 optCellToInputWeights =
1558 OverrideDataType(cLayer->m_PeepholeParameters.m_CellToInputWeights->GetTensorInfo(),
1560 paramsInfo.m_CellToInputWeights = &optCellToInputWeights;
1562 optCellToForgetWeights =
1563 OverrideDataType(cLayer->m_PeepholeParameters.m_CellToForgetWeights->GetTensorInfo(), dataType);
1564 paramsInfo.m_CellToForgetWeights = &optCellToForgetWeights;
1565 optCellToOutputWeights =
1566 OverrideDataType(cLayer->m_PeepholeParameters.m_CellToOutputWeights->GetTensorInfo(), dataType);
1567 paramsInfo.m_CellToOutputWeights = &optCellToOutputWeights;
1570 if(descriptor.m_LayerNormEnabled)
1572 if (!descriptor.m_CifgEnabled)
1574 optInputLayerNormWeights = OverrideDataType(
1575 cLayer->m_LayerNormParameters.m_InputLayerNormWeights->GetTensorInfo(), dataType);
1576 paramsInfo.m_InputLayerNormWeights = &optInputLayerNormWeights;
1579 optForgetLayerNormWeights = OverrideDataType(
1580 cLayer->m_LayerNormParameters.m_ForgetLayerNormWeights->GetTensorInfo(), dataType);
1581 paramsInfo.m_ForgetLayerNormWeights = &optForgetLayerNormWeights;
1583 optCellLayerNormWeights = OverrideDataType(
1584 cLayer->m_LayerNormParameters.m_CellLayerNormWeights->GetTensorInfo(), dataType);
1585 paramsInfo.m_CellLayerNormWeights = &optCellLayerNormWeights;
1587 optOutputLayerNormWeights = OverrideDataType(
1588 cLayer->m_LayerNormParameters.m_OutputLayerNormWeights->GetTensorInfo(), dataType);
1589 paramsInfo.m_OutputLayerNormWeights = &optOutputLayerNormWeights;
1592 result = layerSupportObject.IsUnidirectionalSequenceLstmSupported(input,
1605 ARMNN_ASSERT_MSG(
false,
"WorkloadFactory did not recognise type of layer.");
1606 reason.value() =
"Unrecognised layer type";
1617 std::string& outReasonIfUnsupported)
1619 return IsLayerConfigurationSupported(backendId, connectableLayer, dataType, outReasonIfUnsupported);
1624 std::string& outReasonIfUnsupported)
1626 auto layer = PolymorphicDowncast<const Layer*>(&connectableLayer);
1627 return IsLayerConfigurationSupported(layer->GetBackendId(), connectableLayer, dataType, outReasonIfUnsupported);
1632 std::string& outReasonIfUnsupported,
1635 auto layer = PolymorphicDowncast<const Layer*>(&connectableLayer);
1636 return IsLayerConfigurationSupported(layer->GetBackendId(),
1639 outReasonIfUnsupported,
1646 std::string& outReasonIfUnsupported,
1649 return IsLayerConfigurationSupported(backendId,
1652 outReasonIfUnsupported,