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 throw InvalidArgumentException(
"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);
267 "Convolution2dLayer: Weights should be connected as a Constant Layer.");
268 const TensorInfo weights = OverrideDataType(layer.GetInputSlot(1).GetTensorInfo(),
271 const Convolution2dDescriptor& descriptor = cLayer->GetParameters();
274 Optional<TensorInfo> biases;
275 if (descriptor.m_BiasEnabled)
278 "Convolution2dLayer:Bias should be connected as a Constant Layer.");
279 biases = OverrideDataType(layer.GetInputSlot(2).GetTensorInfo(),
283 result = layerSupportObject.IsConvolution2dSupported(
294 auto cLayer = PolymorphicDowncast<const Convolution3dLayer*>(&layer);
296 const TensorInfo input = OverrideDataType(layer.GetInputSlot(0).GetTensorInfo(),
298 const TensorInfo output = OverrideDataType(layer.GetOutputSlot(0).GetTensorInfo(), dataType);
301 "Convolution3dLayer: Weights should be connected as a Constant Layer.");
302 const TensorInfo weights = OverrideDataType(layer.GetInputSlot(1).GetTensorInfo(),
305 const Convolution3dDescriptor& descriptor = cLayer->GetParameters();
308 Optional<TensorInfo> biases;
309 if (descriptor.m_BiasEnabled)
311 biases = OverrideDataType(layer.GetInputSlot(2).GetTensorInfo(),
315 result = layerSupportObject.IsConvolution3dSupported(
326 const TensorInfo& input = layer.GetInputSlot(0).GetTensorInfo();
327 const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo();
329 result = layerSupportObject.IsDebugSupported(OverrideDataType(input, dataType),
330 OverrideDataType(output, dataType),
336 auto cLayer = PolymorphicDowncast<const DepthToSpaceLayer*>(&layer);
338 const TensorInfo& input = layer.GetInputSlot(0).GetTensorInfo();
339 const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo();
341 result = layerSupportObject.IsDepthToSpaceSupported(OverrideDataType(input, dataType),
342 OverrideDataType(output, dataType),
343 cLayer->GetParameters(),
349 auto cLayer = PolymorphicDowncast<const DepthwiseConvolution2dLayer*>(&layer);
350 const TensorInfo& input = OverrideDataType(layer.GetInputSlot(0).GetTensorInfo(),
352 const TensorInfo& output = OverrideDataType(layer.GetOutputSlot(0).GetTensorInfo(), dataType);
353 const TensorInfo& weights = OverrideDataType(layer.GetInputSlot(1).GetTensorInfo(),
356 const DepthwiseConvolution2dDescriptor& descriptor = cLayer->GetParameters();
359 Optional<TensorInfo> biases;
360 if (descriptor.m_BiasEnabled)
362 biases = OverrideDataType(cLayer->GetInputSlot(2).GetTensorInfo(),
366 result = layerSupportObject.IsDepthwiseConvolutionSupported(input,
376 const TensorInfo& input = layer.GetInputSlot(0).GetTensorInfo();
377 const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo();
379 result = layerSupportObject.IsDequantizeSupported(input,
380 OverrideDataType(output, dataType),
386 auto cLayer = PolymorphicDowncast<const DetectionPostProcessLayer*>(&layer);
387 const TensorInfo& boxEncodings = layer.GetInputSlot(0).GetTensorInfo();
388 const TensorInfo& scores = layer.GetInputSlot(1).GetTensorInfo();
389 const TensorInfo& anchors = cLayer->m_Anchors->GetTensorInfo();
391 const TensorInfo& detectionBoxes = layer.GetOutputSlot(0).GetTensorInfo();
392 const TensorInfo& detectionClasses = layer.GetOutputSlot(1).GetTensorInfo();
393 const TensorInfo& detectionScores = layer.GetOutputSlot(2).GetTensorInfo();
394 const TensorInfo& numDetections = layer.GetOutputSlot(3).GetTensorInfo();
396 const DetectionPostProcessDescriptor& descriptor = cLayer->GetParameters();
397 result = layerSupportObject.IsDetectionPostProcessSupported(boxEncodings,
410 auto cLayer = PolymorphicDowncast<const ElementwiseBinaryLayer*>(&layer);
412 const TensorInfo& input0 = layer.GetInputSlot(0).GetTensorInfo();
413 const TensorInfo& input1 = layer.GetInputSlot(1).GetTensorInfo();
414 const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo();
415 std::vector<TensorInfo> infos = { OverrideDataType(input0, dataType),
416 OverrideDataType(input1, dataType),
417 OverrideDataType(output, dataType) };
420 cLayer->GetParameters(),
428 auto cLayer = PolymorphicDowncast<const ElementwiseUnaryLayer*>(&layer);
430 const TensorInfo& input = layer.GetInputSlot(0).GetTensorInfo();
431 const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo();
433 result = layerSupportObject.IsElementwiseUnarySupported(OverrideDataType(input, dataType),
434 OverrideDataType(output, dataType),
435 cLayer->GetParameters(),
441 auto cLayer = PolymorphicDowncast<const FillLayer*>(&layer);
442 const TensorInfo& input = layer.GetInputSlot(0).GetTensorInfo();
443 const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo();
444 const FillDescriptor& descriptor = cLayer->GetParameters();
446 result = layerSupportObject.IsFillSupported(
447 OverrideDataType(input, dataType),
448 OverrideDataType(output, dataType),
455 auto cLayer = PolymorphicDowncast<const FakeQuantizationLayer*>(&layer);
456 const TensorInfo& input = layer.GetInputSlot(0).GetTensorInfo();
457 result = layerSupportObject.IsFakeQuantizationSupported(OverrideDataType(input, dataType),
458 cLayer->GetParameters(),
464 const TensorInfo& input = layer.GetInputSlot(0).GetTensorInfo();
465 const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo();
466 result = layerSupportObject.IsFloorSupported(OverrideDataType(input, dataType),
467 OverrideDataType(output, dataType),
473 auto cLayer = PolymorphicDowncast<const FullyConnectedLayer*>(&layer);
474 const TensorInfo& input = layer.GetInputSlot(0).GetTensorInfo();
475 const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo();
477 const FullyConnectedDescriptor& descriptor = cLayer->GetParameters();
478 TensorInfo weightsInfo;
479 const TensorInfo* weightsInfoPtr =
nullptr;
481 weightsInfo = OverrideDataType(layer.GetInputSlot(1).GetTensorInfo(), dataType);
482 weightsInfoPtr = &weightsInfo;
485 const TensorInfo* biasInfoPtr =
nullptr;
486 static const TensorInfo dummyBFloat16Bias(TensorShape({1,1,1,1}),
DataType::BFloat16);
487 static const TensorInfo dummyFloat16Bias(TensorShape({1,1,1,1}),
DataType::Float16);
488 static const TensorInfo dummyFloat32Bias(TensorShape({1,1,1,1}),
DataType::Float32);
491 if (descriptor.m_BiasEnabled)
493 biasInfo = OverrideDataType(layer.GetInputSlot(2).GetTensorInfo(), dataType);
494 biasInfoPtr = &biasInfo;
499 switch(input.GetDataType())
503 biasInfoPtr = &dummyBFloat16Bias;
508 biasInfoPtr = &dummyFloat16Bias;
513 biasInfoPtr = &dummyFloat32Bias;
521 biasInfoPtr = &dummyQA8Bias;
526 throw InvalidArgumentException(
"Unexpected bias type");
530 result = layerSupportObject.IsFullyConnectedSupported(
531 OverrideDataType(input, dataType),
532 OverrideDataType(output, dataType),
541 auto cLayer = PolymorphicDowncast<const FusedLayer*>(&layer);
544 auto getOutTensorInfo = [&dataType](
const OutputSlot& slot)
546 return OverrideDataType(slot.GetTensorInfo(), dataType);
550 std::vector<TensorInfo> outputs(beginOutputs, endOutputs);
551 const std::vector<std::reference_wrapper<TensorInfo>> outputPtrs(outputs.begin(), outputs.end());
554 auto getInputTensorInfo = [&dataType](
const InputSlot& slot)
556 return OverrideDataType(slot.GetTensorInfo(), dataType);
560 std::vector<TensorInfo> inputs(beginInputs, endInputs);
561 const std::vector<std::reference_wrapper<TensorInfo>> inputPtrs(inputs.begin(), inputs.end());
563 result = layerSupportObject.IsFusedSupported(inputPtrs,
565 cLayer->GetParameters(),
571 const TensorInfo& input0 = layer.GetInputSlot(0).GetTensorInfo();
572 const TensorInfo& input1 = layer.GetInputSlot(1).GetTensorInfo();
573 const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo();
574 auto cLayer = PolymorphicDowncast<const GatherLayer*>(&layer);
575 const GatherDescriptor& descriptor = cLayer->GetParameters();
576 result = layerSupportObject.IsGatherSupported(OverrideDataType(input0, dataType),
578 OverrideDataType(output, dataType),
585 const TensorInfo& input0 = layer.GetInputSlot(0).GetTensorInfo();
586 const TensorInfo& input1 = layer.GetInputSlot(1).GetTensorInfo();
587 const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo();
588 result = layerSupportObject.IsGatherNdSupported(OverrideDataType(input0, dataType),
590 OverrideDataType(output, dataType),
596 const TensorInfo& input = layer.GetOutputSlot(0).GetTensorInfo();
597 result = layerSupportObject.IsInputSupported(OverrideDataType(input, dataType), reason);
602 auto cLayer = PolymorphicDowncast<const InstanceNormalizationLayer*>(&layer);
603 const InstanceNormalizationDescriptor& descriptor = cLayer->GetParameters();
605 const TensorInfo& input = layer.GetInputSlot(0).GetTensorInfo();
606 const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo();
608 result = layerSupportObject.IsInstanceNormalizationSupported(
609 OverrideDataType(input, dataType),
610 OverrideDataType(output, dataType),
617 auto cLayer = PolymorphicDowncast<const L2NormalizationLayer*>(&layer);
618 const L2NormalizationDescriptor& descriptor = cLayer->GetParameters();
620 const TensorInfo& input = layer.GetInputSlot(0).GetTensorInfo();
621 const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo();
623 result = layerSupportObject.IsL2NormalizationSupported(
624 OverrideDataType(input, dataType),
625 OverrideDataType(output, dataType),
632 auto cLayer = PolymorphicDowncast<const LogicalBinaryLayer*>(&layer);
634 const TensorInfo& input0 = layer.GetInputSlot(0).GetTensorInfo();
635 const TensorInfo& input1 = layer.GetInputSlot(1).GetTensorInfo();
636 const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo();
638 result = layerSupportObject.IsLogicalBinarySupported(input0,
641 cLayer->GetParameters(),
647 auto cLayer = PolymorphicDowncast<const LogSoftmaxLayer*>(&layer);
649 const TensorInfo& input = layer.GetInputSlot(0).GetTensorInfo();
650 const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo();
652 result = layerSupportObject.IsLogSoftmaxSupported(OverrideDataType(input, dataType),
653 OverrideDataType(output, dataType),
654 cLayer->GetParameters(),
660 auto cLayer = PolymorphicDowncast<const LstmLayer*>(&layer);
661 const LstmDescriptor& descriptor = cLayer->GetParameters();
664 const TensorInfo& input = OverrideDataType(layer.GetInputSlot(0).GetTensorInfo(),
666 const TensorInfo& outputStateIn = OverrideDataType(layer.GetInputSlot(1).GetTensorInfo(),
668 const TensorInfo& cellStateIn = OverrideDataType(layer.GetInputSlot(2).GetTensorInfo(),
671 const TensorInfo& scratchBuffer = OverrideDataType(layer.GetOutputSlot(0).GetTensorInfo(), dataType);
672 const TensorInfo& outputStateOut = OverrideDataType(layer.GetOutputSlot(1).GetTensorInfo(), dataType);
673 const TensorInfo& cellStateOut = OverrideDataType(layer.GetOutputSlot(2).GetTensorInfo(), dataType);
674 const TensorInfo& output = OverrideDataType(layer.GetOutputSlot(3).GetTensorInfo(), dataType);
677 const TensorInfo& inputToForgetWeights
678 = OverrideDataType(cLayer->m_BasicParameters.m_InputToForgetWeights->GetTensorInfo(), dataType);
679 const TensorInfo& inputToCellWeights
680 = OverrideDataType(cLayer->m_BasicParameters.m_InputToCellWeights->GetTensorInfo(), dataType);
681 const TensorInfo& inputToOutputWeights
682 = OverrideDataType(cLayer->m_BasicParameters.m_InputToOutputWeights->GetTensorInfo(), dataType);
683 const TensorInfo& recurrentToForgetWeights
684 = OverrideDataType(cLayer->m_BasicParameters.m_RecurrentToForgetWeights->GetTensorInfo(), dataType);
685 const TensorInfo& recurrentToCellWeights
686 = OverrideDataType(cLayer->m_BasicParameters.m_RecurrentToCellWeights->GetTensorInfo(), dataType);
687 const TensorInfo& recurrentToOutputWeights
688 = OverrideDataType(cLayer->m_BasicParameters.m_RecurrentToOutputWeights->GetTensorInfo(), dataType);
689 const TensorInfo& forgetGateBias
690 = OverrideDataType(cLayer->m_BasicParameters.m_ForgetGateBias->GetTensorInfo(), dataType);
691 const TensorInfo& cellBias
692 = OverrideDataType(cLayer->m_BasicParameters.m_CellBias->GetTensorInfo(), dataType);
693 const TensorInfo& outputGateBias
694 = OverrideDataType(cLayer->m_BasicParameters.m_OutputGateBias->GetTensorInfo(), dataType);
696 LstmInputParamsInfo paramsInfo;
698 paramsInfo.m_InputToForgetWeights = &inputToForgetWeights;
699 paramsInfo.m_InputToCellWeights = &inputToCellWeights;
700 paramsInfo.m_InputToOutputWeights = &inputToOutputWeights;
701 paramsInfo.m_RecurrentToForgetWeights = &recurrentToForgetWeights;
702 paramsInfo.m_RecurrentToCellWeights = &recurrentToCellWeights;
703 paramsInfo.m_RecurrentToOutputWeights = &recurrentToOutputWeights;
704 paramsInfo.m_ForgetGateBias = &forgetGateBias;
705 paramsInfo.m_CellBias = &cellBias;
706 paramsInfo.m_OutputGateBias = &outputGateBias;
710 TensorInfo optInputToInputWeights;
711 TensorInfo optRecurrentToInputWeights;
712 TensorInfo optCellToInputWeights;
713 TensorInfo optInputGateBias;
714 TensorInfo optProjectionWeights;
715 TensorInfo optProjectionBias;
716 TensorInfo optCellToForgetWeights;
717 TensorInfo optCellToOutputWeights;
718 TensorInfo optInputLayerNormWeights;
719 TensorInfo optForgetLayerNormWeights;
720 TensorInfo optCellLayerNormWeights;
721 TensorInfo optOutputLayerNormWeights;
723 if(!descriptor.m_CifgEnabled)
725 optInputToInputWeights =
726 OverrideDataType(cLayer->m_CifgParameters.m_InputToInputWeights->GetTensorInfo(), dataType);
727 paramsInfo.m_InputToInputWeights = &optInputToInputWeights;
729 optRecurrentToInputWeights =
730 OverrideDataType(cLayer->m_CifgParameters.m_RecurrentToInputWeights->GetTensorInfo(), dataType);
731 paramsInfo.m_RecurrentToInputWeights = &optRecurrentToInputWeights;
733 OverrideDataType(cLayer->m_CifgParameters.m_InputGateBias->GetTensorInfo(), dataType);
734 paramsInfo.m_InputGateBias = &optInputGateBias;
737 if(descriptor.m_ProjectionEnabled)
739 optProjectionWeights =
740 OverrideDataType(cLayer->m_ProjectionParameters.m_ProjectionWeights->GetTensorInfo(), dataType);
741 paramsInfo.m_ProjectionWeights = &optProjectionWeights;
742 if (cLayer->m_ProjectionParameters.m_ProjectionBias !=
nullptr)
745 OverrideDataType(cLayer->m_ProjectionParameters.m_ProjectionBias->GetTensorInfo(), dataType);
746 paramsInfo.m_ProjectionBias = &optProjectionBias;
750 if(descriptor.m_PeepholeEnabled)
752 if(!descriptor.m_CifgEnabled)
754 optCellToInputWeights =
755 OverrideDataType(cLayer->m_PeepholeParameters.m_CellToInputWeights->GetTensorInfo(),
757 paramsInfo.m_CellToInputWeights = &optCellToInputWeights;
759 optCellToForgetWeights =
760 OverrideDataType(cLayer->m_PeepholeParameters.m_CellToForgetWeights->GetTensorInfo(), dataType);
761 paramsInfo.m_CellToForgetWeights = &optCellToForgetWeights;
762 optCellToOutputWeights =
763 OverrideDataType(cLayer->m_PeepholeParameters.m_CellToOutputWeights->GetTensorInfo(), dataType);
764 paramsInfo.m_CellToOutputWeights = &optCellToOutputWeights;
767 if(descriptor.m_LayerNormEnabled)
769 if (!descriptor.m_CifgEnabled)
771 optInputLayerNormWeights = OverrideDataType(
772 cLayer->m_LayerNormParameters.m_InputLayerNormWeights->GetTensorInfo(), dataType);
773 paramsInfo.m_InputLayerNormWeights = &optInputLayerNormWeights;
776 optForgetLayerNormWeights = OverrideDataType(
777 cLayer->m_LayerNormParameters.m_ForgetLayerNormWeights->GetTensorInfo(), dataType);
778 paramsInfo.m_ForgetLayerNormWeights = &optForgetLayerNormWeights;
780 optCellLayerNormWeights = OverrideDataType(
781 cLayer->m_LayerNormParameters.m_CellLayerNormWeights->GetTensorInfo(), dataType);
782 paramsInfo.m_CellLayerNormWeights = &optCellLayerNormWeights;
784 optOutputLayerNormWeights = OverrideDataType(
785 cLayer->m_LayerNormParameters.m_OutputLayerNormWeights->GetTensorInfo(), dataType);
786 paramsInfo.m_OutputLayerNormWeights = &optOutputLayerNormWeights;
789 result = layerSupportObject.IsLstmSupported(
805 const TensorInfo& input0 = layer.GetInputSlot(0).GetTensorInfo();
806 const TensorInfo& input1 = layer.GetInputSlot(1).GetTensorInfo();
807 const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo();
809 result = layerSupportObject.IsMaximumSupported(OverrideDataType(input0, dataType),
810 OverrideDataType(input1, dataType),
811 OverrideDataType(output, dataType),
818 const TensorInfo& input = layer.GetInputSlot(0).GetTensorInfo();
819 const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo();
821 result = layerSupportObject.IsMemCopySupported(OverrideDataType(input, dataType),
822 OverrideDataType(output, dataType),
828 const TensorInfo& input = layer.GetInputSlot(0).GetTensorInfo();
829 const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo();
831 result = layerSupportObject.IsMemImportSupported(OverrideDataType(input, dataType),
832 OverrideDataType(output, dataType),
838 const TensorInfo& input0 = layer.GetInputSlot(0).GetTensorInfo();
839 const TensorInfo& input1 = layer.GetInputSlot(1).GetTensorInfo();
840 const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo();
842 result = layerSupportObject.IsMergeSupported(OverrideDataType(input0, dataType),
843 OverrideDataType(input1, dataType),
844 OverrideDataType(output, dataType),
850 auto cLayer = PolymorphicDowncast<const ConcatLayer*>(&layer);
853 auto getTensorInfo = [&dataType](
const InputSlot& slot)
855 return OverrideDataType(slot.GetConnectedOutputSlot()->GetTensorInfo(), dataType);
860 std::vector<TensorInfo> inputs(beginI, endI);
862 auto getTensorInfoPtr = [](
const TensorInfo&
info)
869 std::vector<const TensorInfo*> inputPtrs(beginPtr, endPtr);
871 const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo();
873 result = layerSupportObject.IsConcatSupported(inputPtrs, output, cLayer->GetParameters(), reason);
881 const TensorInfo& input0 = layer.GetInputSlot(0).GetTensorInfo();
882 const TensorInfo& input1 = layer.GetInputSlot(1).GetTensorInfo();
883 const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo();
884 result = layerSupportObject.IsMultiplicationSupported(
885 OverrideDataType(input0, dataType),
886 OverrideDataType(input1, dataType),
887 OverrideDataType(output, dataType),
894 auto cLayer = PolymorphicDowncast<const NormalizationLayer*>(&layer);
895 const TensorInfo& input = layer.GetInputSlot(0).GetTensorInfo();
896 const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo();
897 result = layerSupportObject.IsNormalizationSupported(OverrideDataType(input, dataType),
898 OverrideDataType(output, dataType),
899 cLayer->GetParameters(),
905 const TensorInfo& output = layer.GetInputSlot(0).GetTensorInfo();
906 result = layerSupportObject.IsOutputSupported(OverrideDataType(output, dataType), reason);
911 auto cLayer = PolymorphicDowncast<const PermuteLayer*>(&layer);
912 const TensorInfo& input = layer.GetInputSlot(0).GetTensorInfo();
913 const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo();
914 result = layerSupportObject.IsPermuteSupported(OverrideDataType(input, dataType),
915 OverrideDataType(output, dataType),
916 cLayer->GetParameters(),
922 auto cLayer = PolymorphicDowncast<const PadLayer*>(&layer);
923 const TensorInfo& input = layer.GetInputSlot(0).GetTensorInfo();
924 const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo();
925 result = layerSupportObject.IsPadSupported(
926 OverrideDataType(input, dataType),
927 OverrideDataType(output, dataType),
928 cLayer->GetParameters(),
934 auto cLayer = PolymorphicDowncast<const Pooling2dLayer*>(&layer);
935 const TensorInfo& input = layer.GetInputSlot(0).GetTensorInfo();
936 const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo();
937 result = layerSupportObject.IsPooling2dSupported(OverrideDataType(input, dataType),
938 OverrideDataType(output, dataType),
939 cLayer->GetParameters(),
945 auto cLayer = PolymorphicDowncast<const Pooling3dLayer*>(&layer);
946 const TensorInfo& input = layer.GetInputSlot(0).GetTensorInfo();
947 const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo();
948 result = layerSupportObject.IsPooling3dSupported(OverrideDataType(input, dataType),
949 OverrideDataType(output, dataType),
950 cLayer->GetParameters(),
956 auto cLayer = PolymorphicDowncast<const PreCompiledLayer*>(&layer);
957 const TensorInfo& input = layer.GetInputSlot(0).GetTensorInfo();
958 result = layerSupportObject.IsPreCompiledSupported(OverrideDataType(input, dataType),
959 cLayer->GetParameters(),
965 const TensorInfo& input = layer.GetInputSlot(0).GetTensorInfo();
966 const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo();
967 result = layerSupportObject.IsQuantizeSupported(input, output, reason);
972 auto cLayer = PolymorphicDowncast<const QLstmLayer*>(&layer);
973 const QLstmDescriptor& descriptor = cLayer->GetParameters();
976 const TensorInfo& input = layer.GetInputSlot(0).GetTensorInfo();
977 const TensorInfo& previousOutputIn = layer.GetInputSlot(1).GetTensorInfo();
978 const TensorInfo& previousCellStateIn = layer.GetInputSlot(2).GetTensorInfo();
981 const TensorInfo& outputStateOut = layer.GetOutputSlot(0).GetTensorInfo();
982 const TensorInfo& cellStateOut = layer.GetOutputSlot(1).GetTensorInfo();
983 const TensorInfo& output = layer.GetOutputSlot(2).GetTensorInfo();
986 LstmInputParamsInfo paramsInfo;
989 paramsInfo.m_InputToForgetWeights = &cLayer->m_BasicParameters.m_InputToForgetWeights->GetTensorInfo();
990 paramsInfo.m_InputToCellWeights = &cLayer->m_BasicParameters.m_InputToCellWeights->GetTensorInfo();
991 paramsInfo.m_InputToOutputWeights = &cLayer->m_BasicParameters.m_InputToOutputWeights->GetTensorInfo();
993 paramsInfo.m_RecurrentToForgetWeights =
994 &cLayer->m_BasicParameters.m_RecurrentToForgetWeights->GetTensorInfo();
995 paramsInfo.m_RecurrentToCellWeights =
996 &cLayer->m_BasicParameters.m_RecurrentToCellWeights->GetTensorInfo();
997 paramsInfo.m_RecurrentToOutputWeights =
998 &cLayer->m_BasicParameters.m_RecurrentToOutputWeights->GetTensorInfo();
1000 paramsInfo.m_ForgetGateBias = &cLayer->m_BasicParameters.m_ForgetGateBias->GetTensorInfo();
1001 paramsInfo.m_CellBias = &cLayer->m_BasicParameters.m_CellBias->GetTensorInfo();
1002 paramsInfo.m_OutputGateBias = &cLayer->m_BasicParameters.m_OutputGateBias->GetTensorInfo();
1004 if(!descriptor.m_CifgEnabled)
1006 paramsInfo.m_InputToInputWeights = &cLayer->m_CifgParameters.m_InputToInputWeights->GetTensorInfo();
1007 paramsInfo.m_RecurrentToInputWeights =
1008 &cLayer->m_CifgParameters.m_RecurrentToInputWeights->GetTensorInfo();
1009 paramsInfo.m_InputGateBias = &cLayer->m_CifgParameters.m_InputGateBias->GetTensorInfo();
1012 if(descriptor.m_ProjectionEnabled)
1014 paramsInfo.m_ProjectionWeights = &cLayer->m_ProjectionParameters.m_ProjectionWeights->GetTensorInfo();
1017 if (cLayer->m_ProjectionParameters.m_ProjectionBias !=
nullptr)
1019 paramsInfo.m_ProjectionBias = &cLayer->m_ProjectionParameters.m_ProjectionBias->GetTensorInfo();
1023 if(descriptor.m_PeepholeEnabled)
1025 if (!descriptor.m_CifgEnabled)
1027 paramsInfo.m_CellToInputWeights =
1028 &cLayer->m_PeepholeParameters.m_CellToInputWeights->GetTensorInfo();
1031 paramsInfo.m_CellToForgetWeights =
1032 &cLayer->m_PeepholeParameters.m_CellToForgetWeights->GetTensorInfo();
1033 paramsInfo.m_CellToOutputWeights = &cLayer->m_PeepholeParameters.m_CellToOutputWeights->GetTensorInfo();
1036 if(descriptor.m_LayerNormEnabled)
1038 if (!descriptor.m_CifgEnabled)
1040 paramsInfo.m_InputLayerNormWeights =
1041 &cLayer->m_LayerNormParameters.m_InputLayerNormWeights->GetTensorInfo();
1044 paramsInfo.m_ForgetLayerNormWeights =
1045 &cLayer->m_LayerNormParameters.m_ForgetLayerNormWeights->GetTensorInfo();
1046 paramsInfo.m_CellLayerNormWeights =
1047 &cLayer->m_LayerNormParameters.m_CellLayerNormWeights->GetTensorInfo();
1048 paramsInfo.m_OutputLayerNormWeights =
1049 &cLayer->m_LayerNormParameters.m_OutputLayerNormWeights->GetTensorInfo();
1052 result = layerSupportObject.IsQLstmSupported(input,
1054 previousCellStateIn,
1065 auto cLayer = PolymorphicDowncast<const QuantizedLstmLayer*>(&layer);
1068 const TensorInfo& input = layer.GetInputSlot(0).GetTensorInfo();
1069 const TensorInfo& previousCellStateIn = layer.GetInputSlot(1).GetTensorInfo();
1070 const TensorInfo& previousOutputIn = layer.GetInputSlot(2).GetTensorInfo();
1073 const TensorInfo& cellStateOut = layer.GetOutputSlot(0).GetTensorInfo();
1074 const TensorInfo& output = layer.GetOutputSlot(1).GetTensorInfo();
1077 QuantizedLstmInputParamsInfo paramsInfo;
1079 paramsInfo.m_InputToInputWeights =
1080 &cLayer->m_QuantizedLstmParameters.m_InputToInputWeights->GetTensorInfo();
1081 paramsInfo.m_InputToForgetWeights =
1082 &cLayer->m_QuantizedLstmParameters.m_InputToForgetWeights->GetTensorInfo();
1083 paramsInfo.m_InputToCellWeights =
1084 &cLayer->m_QuantizedLstmParameters.m_InputToCellWeights->GetTensorInfo();
1085 paramsInfo.m_InputToOutputWeights =
1086 &cLayer->m_QuantizedLstmParameters.m_InputToOutputWeights->GetTensorInfo();
1088 paramsInfo.m_RecurrentToInputWeights =
1089 &cLayer->m_QuantizedLstmParameters.m_RecurrentToInputWeights->GetTensorInfo();
1090 paramsInfo.m_RecurrentToForgetWeights =
1091 &cLayer->m_QuantizedLstmParameters.m_RecurrentToForgetWeights->GetTensorInfo();
1092 paramsInfo.m_RecurrentToCellWeights =
1093 &cLayer->m_QuantizedLstmParameters.m_RecurrentToCellWeights->GetTensorInfo();
1094 paramsInfo.m_RecurrentToOutputWeights =
1095 &cLayer->m_QuantizedLstmParameters.m_RecurrentToOutputWeights->GetTensorInfo();
1097 paramsInfo.m_InputGateBias =
1098 &cLayer->m_QuantizedLstmParameters.m_InputGateBias->GetTensorInfo();
1099 paramsInfo.m_ForgetGateBias =
1100 &cLayer->m_QuantizedLstmParameters.m_ForgetGateBias->GetTensorInfo();
1101 paramsInfo.m_CellBias =
1102 &cLayer->m_QuantizedLstmParameters.m_CellBias->GetTensorInfo();
1103 paramsInfo.m_OutputGateBias =
1104 &cLayer->m_QuantizedLstmParameters.m_OutputGateBias->GetTensorInfo();;
1106 result = layerSupportObject.IsQuantizedLstmSupported(input,
1107 previousCellStateIn,
1118 const TensorInfo& input0 = layer.GetInputSlot(0).GetTensorInfo();
1119 const TensorInfo& input1 = layer.GetInputSlot(1).GetTensorInfo();
1120 const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo();
1121 result = layerSupportObject.IsDivisionSupported(
1122 OverrideDataType(input0, dataType),
1123 OverrideDataType(input1, dataType),
1124 OverrideDataType(output, dataType),
1131 const TensorInfo& input = layer.GetInputSlot(0).GetTensorInfo();
1132 const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo();
1133 result = layerSupportObject.IsRankSupported(OverrideDataType(input, dataType),
1134 OverrideDataType(output, dataType),
1140 auto cLayer = PolymorphicDowncast<const ReshapeLayer*>(&layer);
1141 const TensorInfo& input = layer.GetInputSlot(0).GetTensorInfo();
1142 const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo();
1143 result = layerSupportObject.IsReshapeSupported(OverrideDataType(input, dataType),
1144 OverrideDataType(output, dataType),
1145 cLayer->GetParameters(),
1151 auto cLayer = PolymorphicDowncast<const ResizeLayer*>(&layer);
1152 const TensorInfo& input = layer.GetInputSlot(0).GetTensorInfo();
1153 const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo();
1154 result = layerSupportObject.IsResizeSupported(OverrideDataType(input, dataType),
1155 OverrideDataType(output, dataType),
1156 cLayer->GetParameters(),
1162 const TensorInfo& input0 = layer.GetInputSlot(0).GetConnection()->GetTensorInfo();
1163 const TensorInfo& input1 = layer.GetInputSlot(1).GetConnection()->GetTensorInfo();
1164 const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo();
1165 result = layerSupportObject.IsReverseV2Supported(OverrideDataType(input0, dataType),
1167 OverrideDataType(output, dataType),
1173 auto cLayer = PolymorphicDowncast<const ScatterNdLayer*>(&layer);
1174 const TensorInfo& input = layer.GetInputSlot(0).GetTensorInfo();
1175 const TensorInfo& indices = layer.GetInputSlot(1).GetTensorInfo();
1176 const TensorInfo& updates = layer.GetInputSlot(2).GetTensorInfo();
1177 const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo();
1179 result = layerSupportObject.IsScatterNdSupported(OverrideDataType(input, dataType),
1180 OverrideDataType(indices, dataType),
1181 OverrideDataType(updates, dataType),
1182 OverrideDataType(output, dataType),
1183 cLayer->GetParameters(),
1190 const TensorInfo& input = layer.GetInputSlot(0).GetTensorInfo();
1191 const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo();
1193 result = layerSupportObject.IsShapeSupported(OverrideDataType(input, dataType),
1194 OverrideDataType(output, dataType),
1200 auto cLayer = PolymorphicDowncast<const SliceLayer*>(&layer);
1202 const TensorInfo& input = layer.GetInputSlot(0).GetTensorInfo();
1203 const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo();
1205 result = layerSupportObject.IsSliceSupported(OverrideDataType(input, dataType),
1206 OverrideDataType(output, dataType),
1207 cLayer->GetParameters(),
1213 auto cLayer = PolymorphicDowncast<const SoftmaxLayer*>(&layer);
1214 const TensorInfo& input = layer.GetInputSlot(0).GetTensorInfo();
1215 const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo();
1216 result = layerSupportObject.IsSoftmaxSupported(OverrideDataType(input, dataType),
1217 OverrideDataType(output, dataType),
1218 cLayer->GetParameters(),
1224 auto cLayer = PolymorphicDowncast<const SpaceToBatchNdLayer*>(&layer);
1225 const TensorInfo& input = layer.GetInputSlot(0).GetTensorInfo();
1226 const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo();
1227 result = layerSupportObject.IsSpaceToBatchNdSupported(OverrideDataType(input, dataType),
1228 OverrideDataType(output, dataType),
1229 cLayer->GetParameters(),
1235 auto cLayer = PolymorphicDowncast<const SpaceToDepthLayer*>(&layer);
1237 const TensorInfo& input = layer.GetInputSlot(0).GetTensorInfo();
1238 const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo();
1240 result = layerSupportObject.IsSpaceToDepthSupported(OverrideDataType(input, dataType),
1241 OverrideDataType(output, dataType),
1242 cLayer->GetParameters(),
1248 auto cLayer = PolymorphicDowncast<const SplitterLayer*>(&layer);
1249 const TensorInfo& input = layer.GetInputSlot(0).GetTensorInfo();
1252 auto getTensorInfo = [&dataType](
const OutputSlot& slot)
1254 return OverrideDataType(slot.GetTensorInfo(), dataType);
1258 std::vector<TensorInfo> outputs(beginI, endI);
1260 const std::vector<std::reference_wrapper<TensorInfo>> outputPtrs(outputs.begin(), outputs.end());
1262 result = layerSupportObject.IsSplitterSupported(OverrideDataType(input, dataType),
1264 cLayer->GetParameters(),
1270 auto cLayer = PolymorphicDowncast<const StackLayer*>(&layer);
1273 auto getTensorInfo = [&dataType](
const InputSlot& slot)
1275 return OverrideDataType(slot.GetConnectedOutputSlot()->GetTensorInfo(), dataType);
1279 std::vector<TensorInfo> inputs(beginI, endI);
1281 auto getTensorInfoPtr = [](
const TensorInfo&
info)
1287 std::vector<const TensorInfo*> inputPtrs(beginPtr, endPtr);
1289 const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo();
1291 result = layerSupportObject.IsStackSupported(inputPtrs, output, cLayer->GetParameters(), reason);
1297 auto cLayer = PolymorphicDowncast<const StandInLayer*>(&layer);
1300 auto getTensorInfoIn = [&dataType](
const InputSlot& slot)
1302 return OverrideDataType(slot.GetConnectedOutputSlot()->GetTensorInfo(), dataType);
1304 auto getTensorInfoOut = [&dataType](
const OutputSlot& slot)
1306 return OverrideDataType(slot.GetTensorInfo(), dataType);
1310 std::vector<TensorInfo> inputs(beginI, endI);
1314 std::vector<TensorInfo> outputs(beginO, endO);
1317 auto getTensorInfoPtr = [](
const TensorInfo&
info)
1323 std::vector<const TensorInfo*> inputPtrs(beginPtrI, endPtrI);
1327 std::vector<const TensorInfo*> outputPtrs(beginPtrO, endPtrO);
1330 result = layerSupportObject.IsStandInSupported(inputPtrs,
1332 cLayer->GetParameters(),
1338 auto cLayer = PolymorphicDowncast<const StridedSliceLayer*>(&layer);
1339 const TensorInfo& input = layer.GetInputSlot(0).GetTensorInfo();
1340 const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo();
1341 result = layerSupportObject.IsStridedSliceSupported(OverrideDataType(input, dataType),
1342 OverrideDataType(output, dataType),
1343 cLayer->GetParameters(),
1350 const TensorInfo& input0 = layer.GetInputSlot(0).GetTensorInfo();
1351 const TensorInfo& input1 = layer.GetInputSlot(1).GetTensorInfo();
1352 const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo();
1353 result = layerSupportObject.IsSubtractionSupported(
1354 OverrideDataType(input0, dataType),
1355 OverrideDataType(input1, dataType),
1356 OverrideDataType(output, dataType),
1363 const TensorInfo& input0 = layer.GetInputSlot(0).GetTensorInfo();
1364 const TensorInfo& input1 = layer.GetInputSlot(1).GetTensorInfo();
1365 const TensorInfo& output0 = layer.GetOutputSlot(0).GetTensorInfo();
1366 const TensorInfo& output1 = layer.GetOutputSlot(1).GetTensorInfo();
1367 result = layerSupportObject.IsSwitchSupported(OverrideDataType(input0, dataType),
1368 OverrideDataType(input1, dataType),
1369 OverrideDataType(output0, dataType),
1370 OverrideDataType(output1, dataType),
1376 auto cLayer = PolymorphicDowncast<const MeanLayer*>(&layer);
1377 const TensorInfo& input = layer.GetInputSlot(0).GetTensorInfo();
1378 const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo();
1379 result = layerSupportObject.IsMeanSupported(
1380 OverrideDataType(input, dataType),
1381 OverrideDataType(output, dataType),
1382 cLayer->GetParameters(),
1389 const TensorInfo& input0 = layer.GetInputSlot(0).GetTensorInfo();
1390 const TensorInfo& input1 = layer.GetInputSlot(1).GetTensorInfo();
1391 const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo();
1392 result = layerSupportObject.IsMinimumSupported(OverrideDataType(input0, dataType),
1393 OverrideDataType(input1, dataType),
1394 OverrideDataType(output, dataType),
1401 const TensorInfo& input = layer.GetInputSlot(0).GetTensorInfo();
1402 const TensorInfo& alpha = layer.GetInputSlot(1).GetTensorInfo();
1403 const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo();
1404 result = layerSupportObject.IsPreluSupported(OverrideDataType(input, dataType),
1405 OverrideDataType(alpha, dataType),
1406 OverrideDataType(output, dataType),
1412 auto cLayer = PolymorphicDowncast<const TileLayer*>(&layer);
1413 const TensorInfo& input = layer.GetInputSlot(0).GetTensorInfo();
1414 const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo();
1416 result = layerSupportObject.IsTileSupported(OverrideDataType(input, dataType),
1417 OverrideDataType(output, dataType),
1418 cLayer->GetParameters(),
1425 auto cLayer = PolymorphicDowncast<const TransposeLayer*>(&layer);
1426 const TensorInfo& input = layer.GetInputSlot(0).GetTensorInfo();
1427 const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo();
1428 result = layerSupportObject.IsTransposeSupported(OverrideDataType(input, dataType),
1429 OverrideDataType(output, dataType),
1430 cLayer->GetParameters(),
1436 auto cLayer = PolymorphicDowncast<const TransposeConvolution2dLayer*>(&layer);
1438 const TensorInfo input = OverrideDataType(layer.GetInputSlot(0).GetTensorInfo(),
1440 const TensorInfo output = OverrideDataType(layer.GetOutputSlot(0).GetTensorInfo(), dataType);
1442 const TransposeConvolution2dDescriptor& descriptor = cLayer->GetParameters();
1444 Optional<TensorInfo> biases;
1445 if (descriptor.m_BiasEnabled)
1448 cLayer->m_Bias.get() !=
nullptr,
1449 "TransposeConvolution2d: Bias was enabled in the descriptor but no value was supplied.");
1450 biases = OverrideDataType(cLayer->m_Bias->GetTensorInfo(),
1455 "TransposeConvolution2d: Weights cannot be null.");
1456 const TensorInfo weights = OverrideDataType(cLayer->m_Weight->GetTensorInfo(), dataType);
1458 result = layerSupportObject.IsTransposeConvolution2dSupported(input,
1469 auto cLayer = PolymorphicDowncast<const ReduceLayer*>(&layer);
1470 const TensorInfo& input = layer.GetInputSlot(0).GetTensorInfo();
1471 const TensorInfo& output = layer.GetOutputSlot(0).GetTensorInfo();
1473 result = layerSupportObject.IsReduceSupported(OverrideDataType(input, dataType),
1474 OverrideDataType(output, dataType),
1475 cLayer->GetParameters(),
1481 auto cLayer = PolymorphicDowncast<const UnidirectionalSequenceLstmLayer*>(&layer);
1485 const TensorInfo& input = OverrideDataType(layer.GetInputSlot(0).GetTensorInfo(),
1487 const TensorInfo& outputStateIn = OverrideDataType(layer.GetInputSlot(1).GetTensorInfo(),
1489 const TensorInfo& cellStateIn = OverrideDataType(layer.GetInputSlot(2).GetTensorInfo(),
1492 const TensorInfo& outputStateOut = OverrideDataType(layer.GetOutputSlot(0).GetTensorInfo(), dataType);
1493 const TensorInfo& cellStateOut = OverrideDataType(layer.GetOutputSlot(1).GetTensorInfo(), dataType);
1494 const TensorInfo& output = OverrideDataType(layer.GetOutputSlot(2).GetTensorInfo(), dataType);
1497 const TensorInfo& inputToForgetWeights
1498 = OverrideDataType(cLayer->m_BasicParameters.m_InputToForgetWeights->GetTensorInfo(), dataType);
1499 const TensorInfo& inputToCellWeights
1500 = OverrideDataType(cLayer->m_BasicParameters.m_InputToCellWeights->GetTensorInfo(), dataType);
1501 const TensorInfo& inputToOutputWeights
1502 = OverrideDataType(cLayer->m_BasicParameters.m_InputToOutputWeights->GetTensorInfo(), dataType);
1503 const TensorInfo& recurrentToForgetWeights
1504 = OverrideDataType(cLayer->m_BasicParameters.m_RecurrentToForgetWeights->GetTensorInfo(), dataType);
1505 const TensorInfo& recurrentToCellWeights
1506 = OverrideDataType(cLayer->m_BasicParameters.m_RecurrentToCellWeights->GetTensorInfo(), dataType);
1507 const TensorInfo& recurrentToOutputWeights
1508 = OverrideDataType(cLayer->m_BasicParameters.m_RecurrentToOutputWeights->GetTensorInfo(), dataType);
1509 const TensorInfo& forgetGateBias
1510 = OverrideDataType(cLayer->m_BasicParameters.m_ForgetGateBias->GetTensorInfo(), dataType);
1511 const TensorInfo& cellBias
1512 = OverrideDataType(cLayer->m_BasicParameters.m_CellBias->GetTensorInfo(), dataType);
1513 const TensorInfo& outputGateBias
1514 = OverrideDataType(cLayer->m_BasicParameters.m_OutputGateBias->GetTensorInfo(), dataType);
1516 LstmInputParamsInfo paramsInfo;
1518 paramsInfo.m_InputToForgetWeights = &inputToForgetWeights;
1519 paramsInfo.m_InputToCellWeights = &inputToCellWeights;
1520 paramsInfo.m_InputToOutputWeights = &inputToOutputWeights;
1521 paramsInfo.m_RecurrentToForgetWeights = &recurrentToForgetWeights;
1522 paramsInfo.m_RecurrentToCellWeights = &recurrentToCellWeights;
1523 paramsInfo.m_RecurrentToOutputWeights = &recurrentToOutputWeights;
1524 paramsInfo.m_ForgetGateBias = &forgetGateBias;
1525 paramsInfo.m_CellBias = &cellBias;
1526 paramsInfo.m_OutputGateBias = &outputGateBias;
1529 TensorInfo optInputToInputWeights;
1530 TensorInfo optRecurrentToInputWeights;
1531 TensorInfo optCellToInputWeights;
1532 TensorInfo optInputGateBias;
1533 TensorInfo optProjectionWeights;
1534 TensorInfo optProjectionBias;
1535 TensorInfo optCellToForgetWeights;
1536 TensorInfo optCellToOutputWeights;
1537 TensorInfo optInputLayerNormWeights;
1538 TensorInfo optForgetLayerNormWeights;
1539 TensorInfo optCellLayerNormWeights;
1540 TensorInfo optOutputLayerNormWeights;
1542 if(!descriptor.m_CifgEnabled)
1544 optInputToInputWeights =
1545 OverrideDataType(cLayer->m_CifgParameters.m_InputToInputWeights->GetTensorInfo(), dataType);
1546 paramsInfo.m_InputToInputWeights = &optInputToInputWeights;
1548 optRecurrentToInputWeights =
1549 OverrideDataType(cLayer->m_CifgParameters.m_RecurrentToInputWeights->GetTensorInfo(), dataType);
1550 paramsInfo.m_RecurrentToInputWeights = &optRecurrentToInputWeights;
1552 OverrideDataType(cLayer->m_CifgParameters.m_InputGateBias->GetTensorInfo(), dataType);
1553 paramsInfo.m_InputGateBias = &optInputGateBias;
1556 if(descriptor.m_ProjectionEnabled)
1558 optProjectionWeights =
1559 OverrideDataType(cLayer->m_ProjectionParameters.m_ProjectionWeights->GetTensorInfo(), dataType);
1560 paramsInfo.m_ProjectionWeights = &optProjectionWeights;
1561 if (cLayer->m_ProjectionParameters.m_ProjectionBias !=
nullptr)
1564 OverrideDataType(cLayer->m_ProjectionParameters.m_ProjectionBias->GetTensorInfo(), dataType);
1565 paramsInfo.m_ProjectionBias = &optProjectionBias;
1569 if(descriptor.m_PeepholeEnabled)
1571 if(!descriptor.m_CifgEnabled)
1573 optCellToInputWeights =
1574 OverrideDataType(cLayer->m_PeepholeParameters.m_CellToInputWeights->GetTensorInfo(),
1576 paramsInfo.m_CellToInputWeights = &optCellToInputWeights;
1578 optCellToForgetWeights =
1579 OverrideDataType(cLayer->m_PeepholeParameters.m_CellToForgetWeights->GetTensorInfo(), dataType);
1580 paramsInfo.m_CellToForgetWeights = &optCellToForgetWeights;
1581 optCellToOutputWeights =
1582 OverrideDataType(cLayer->m_PeepholeParameters.m_CellToOutputWeights->GetTensorInfo(), dataType);
1583 paramsInfo.m_CellToOutputWeights = &optCellToOutputWeights;
1586 if(descriptor.m_LayerNormEnabled)
1588 if (!descriptor.m_CifgEnabled)
1590 optInputLayerNormWeights = OverrideDataType(
1591 cLayer->m_LayerNormParameters.m_InputLayerNormWeights->GetTensorInfo(), dataType);
1592 paramsInfo.m_InputLayerNormWeights = &optInputLayerNormWeights;
1595 optForgetLayerNormWeights = OverrideDataType(
1596 cLayer->m_LayerNormParameters.m_ForgetLayerNormWeights->GetTensorInfo(), dataType);
1597 paramsInfo.m_ForgetLayerNormWeights = &optForgetLayerNormWeights;
1599 optCellLayerNormWeights = OverrideDataType(
1600 cLayer->m_LayerNormParameters.m_CellLayerNormWeights->GetTensorInfo(), dataType);
1601 paramsInfo.m_CellLayerNormWeights = &optCellLayerNormWeights;
1603 optOutputLayerNormWeights = OverrideDataType(
1604 cLayer->m_LayerNormParameters.m_OutputLayerNormWeights->GetTensorInfo(), dataType);
1605 paramsInfo.m_OutputLayerNormWeights = &optOutputLayerNormWeights;
1608 result = layerSupportObject.IsUnidirectionalSequenceLstmSupported(input,
1621 reason.value() =
"Unrecognised layer type";
1632 std::string& outReasonIfUnsupported)
1634 return IsLayerConfigurationSupported(backendId, connectableLayer, dataType, outReasonIfUnsupported);
1639 std::string& outReasonIfUnsupported)
1641 auto layer = PolymorphicDowncast<const Layer*>(&connectableLayer);
1642 return IsLayerConfigurationSupported(layer->GetBackendId(), connectableLayer, dataType, outReasonIfUnsupported);
1647 std::string& outReasonIfUnsupported,
1650 auto layer = PolymorphicDowncast<const Layer*>(&connectableLayer);
1651 return IsLayerConfigurationSupported(layer->GetBackendId(),
1654 outReasonIfUnsupported,
1661 std::string& outReasonIfUnsupported,
1664 return IsLayerConfigurationSupported(backendId,
1667 outReasonIfUnsupported,