24 #ifndef ARM_COMPUTE_GRAPH_BACKENDS_DETAIL_FUNCTION_HELPERS_H 25 #define ARM_COMPUTE_GRAPH_BACKENDS_DETAIL_FUNCTION_HELPERS_H 58 template <
typename TargetInfo>
68 backing_tensor = (tensor_handle !=
nullptr) ? arm_compute::utils::cast::polymorphic_cast<typename TargetInfo::TensorType *>(&tensor_handle->tensor()) :
nullptr;
71 return backing_tensor;
74 template <
typename TargetInfo>
78 <<
" Target: " << TargetInfo::TargetType
79 <<
" ID: " << node.
id()
98 template <
typename ActivationLayerFunction,
typename TargetInfo>
101 validate_node<TargetInfo>(node, 1 , 1 );
109 auto func = std::make_unique<ActivationLayerFunction>();
110 func->configure(input, output, act_info);
114 <<
" Type: " << node.type()
115 <<
" Target: " << TargetInfo::TargetType
116 <<
" Data Type: " << input->info()->data_type()
117 <<
" Shape: " << input->info()->tensor_shape()
118 <<
" Activation function: " << act_info.activation()
119 <<
" a: " << act_info.a()
120 <<
" b: " << act_info.b()
124 return std::move(func);
136 template <
typename ArgMinMaxLayerFunction,
typename TargetInfo>
139 validate_node<TargetInfo>(node, 1 , 1 );
145 unsigned int axis = node.axis();
148 auto func = std::make_unique<ArgMinMaxLayerFunction>();
149 func->configure(input, axis, output, op);
153 <<
" Type: " << node.type()
154 <<
" Target: " << TargetInfo::TargetType
155 <<
" Data Type: " << input->info()->data_type()
156 <<
" Shape: " << input->info()->tensor_shape()
157 <<
" Reduction Operation: " << op
161 return std::move(func);
173 template <
typename BatchNormalizationLayerFunction,
typename TargetInfo>
176 validate_node<TargetInfo>(node, 5 , 1 );
186 const float epsilon = node.epsilon();
190 auto func = std::make_unique<BatchNormalizationLayerFunction>();
191 func->configure(input, output, mean, var, beta, gamma, epsilon, fused_act);
196 <<
" Type: " << node.type()
197 <<
" Target: " << TargetInfo::TargetType
198 <<
" Data Type: " << input->info()->data_type()
199 <<
" Shape: " << input->info()->tensor_shape()
200 <<
" Epsilon: " << epsilon <<
" " 205 return std::move(func);
218 template <
typename FusedLayerTypes,
typename TargetInfo>
221 validate_node<TargetInfo>(node, 7 , 1 );
235 const unsigned int num_groups = node.num_groups();
238 const float epsilon = node.epsilon();
242 std::unique_ptr<IFunction> func;
243 std::string func_name;
248 std::tie(func, func_name) = create_named_memory_managed_function<FType>(
249 std::string(
"FusedConvolutionBatchNormalizationLayer"), mm,
input, weights, biases, output, mean, var, beta, gamma,
epsilon,
conv_info,
num_groups, fast_math, fused_act);
254 <<
" Type: " << node.type()
255 <<
" Target: " << TargetInfo::TargetType
256 <<
" Data Type: " << input->info()->data_type()
257 <<
" Input shape: " << input->info()->tensor_shape()
258 <<
" Weights shape: " << weights->info()->tensor_shape()
259 <<
" Output shape: " << output->info()->tensor_shape()
262 return std::move(func);
275 template <
typename FusedLayerTypes,
typename TargetInfo>
278 validate_node<TargetInfo>(node, 7 , 1 );
292 const unsigned int depth_multiplier = node.depth_multiplier();
294 const float epsilon = node.epsilon();
298 std::unique_ptr<IFunction> func;
299 std::string func_name;
304 std::tie(func, func_name) = create_named_memory_managed_function<FType>(
305 std::string(
"FusedDepthwiseConvolutionBatchNormalizationLayer"), mm,
input, weights, biases, output, mean, var, beta, gamma,
epsilon,
conv_info, depth_multiplier, fused_act);
310 <<
" Type: " << node.type()
311 <<
" Target: " << TargetInfo::TargetType
312 <<
" Data Type: " << input->info()->data_type()
313 <<
" Input shape: " << input->info()->tensor_shape()
314 <<
" Weights shape: " << weights->info()->tensor_shape()
315 <<
" Output shape: " << output->info()->tensor_shape()
318 return std::move(func);
330 template <
typename BoundingBoxTransformLayerFunction,
typename TargetInfo>
333 validate_node<TargetInfo>(node, 2 , 1 );
342 auto func = std::make_unique<BoundingBoxTransformLayerFunction>();
343 func->configure(input, output, deltas, bbox_info);
348 <<
" Type: " << node.type()
349 <<
" Target: " << TargetInfo::TargetType
350 <<
" Data Type: " << input->info()->data_type()
351 <<
" Shape: " << input->info()->tensor_shape()
352 <<
" BoundingBox Info img W: " << bbox_info.img_width() <<
" " 353 <<
" BoundingBox Info img H: " << bbox_info.img_height() <<
" " 356 return std::move(func);
368 template <
typename ChannelShuffleLayerFunction,
typename TargetInfo>
371 validate_node<TargetInfo>(node, 1 , 1 );
376 const unsigned int num_groups = node.num_groups();
379 auto func = std::make_unique<ChannelShuffleLayerFunction>();
380 func->configure(input, output, num_groups);
384 <<
" Type: " << node.type()
385 <<
" Target: " << TargetInfo::TargetType
386 <<
" Data Type: " << input->info()->data_type()
387 <<
" Shape: " << input->info()->tensor_shape()
388 <<
" Num groups: " << num_groups
391 return std::move(func);
403 template <
typename ConcatenateLayerFunction,
typename TargetInfo>
416 std::vector<typename TargetInfo::SrcTensorType *> inputs;
417 for(
unsigned int i = 0; i < node.
num_inputs(); ++i)
419 inputs.push_back(get_backing_tensor<TargetInfo>(node.
input(i)));
426 auto func = std::make_unique<ConcatenateLayerFunction>();
427 func->configure(inputs, output, concat_axis);
431 std::ostringstream qss;
434 qss <<
" Output QuantInfo: " << output->info()->quantization_info();
438 <<
" Type: " << node.
type()
439 <<
" Target: " << TargetInfo::TargetType
440 <<
" Data Type: " << output->info()->data_type()
441 <<
" Shape: " << output->info()->tensor_shape()
442 <<
" Num Inputs: " << inputs.size()
443 <<
" Axis: " << concat_axis
447 return std::move(func);
460 template <
typename ConvolutionLayerFunctions,
typename TargetInfo>
463 validate_node<TargetInfo>(node, 3 , 1 );
479 const unsigned int num_groups = node.num_groups();
486 std::unique_ptr<IFunction> func;
487 std::string func_name;
492 std::tie(func, func_name) = create_named_memory_managed_function<typename ConvolutionLayerFunctions::WinogradConvolutionLayer>(
493 std::string(
"WinogradConvolutionLayer"), mm,
499 std::tie(func, func_name) = create_named_function<typename ConvolutionLayerFunctions::DirectConvolutionLayer>(
500 std::string(
"DirectConvolutionLayer"),
505 std::tie(func, func_name) = create_named_memory_managed_function<typename ConvolutionLayerFunctions::GEMMConvolutionLayer>(
506 std::string(
"GEMMConvolutionLayer"), mm,
512 std::tie(func, func_name) = create_named_memory_managed_function<typename ConvolutionLayerFunctions::GenericConvolutionLayer>(
513 std::string(
"GenericConvolutionLayer"), mm,
519 std::ostringstream qss;
522 qss <<
" Input QuantInfo: " << input->info()->quantization_info()
523 <<
" Weights QuantInfo: " << weights->info()->quantization_info()
524 <<
" Output QuantInfo: " << output->info()->quantization_info();
528 <<
" Type: " << func_name
529 <<
" Target: " << TargetInfo::TargetType
530 <<
" Data Type: " << input->info()->data_type()
531 <<
" Groups: " << num_groups
532 <<
" Input shape: " << input->info()->tensor_shape()
533 <<
" Weights shape: " << weights->info()->tensor_shape()
534 <<
" Output shape: " << output->info()->tensor_shape()
538 return std::move(func);
551 template <
typename DeconvolutionLayerFunction,
typename TargetInfo>
554 validate_node<TargetInfo>(node, 3 , 1 );
566 std::unique_ptr<IFunction> func;
568 std::tie(func, std::ignore) = create_named_memory_managed_function<DeconvolutionLayerFunction>(
570 input, weights, biases, output, deconv_info);
575 <<
" Type: " << node.type()
576 <<
" Target: " << TargetInfo::TargetType
577 <<
" Data Type: " << input->info()->data_type()
578 <<
" Input shape: " << input->info()->tensor_shape()
579 <<
" Weights shape: " << weights->info()->tensor_shape()
580 <<
" Output shape: " << output->info()->tensor_shape()
594 template <
typename DepthwiseConvolutionLayer,
typename TargetInfo>
597 validate_node<TargetInfo>(node, 3 , 1 );
613 const unsigned int depth_multiplier = node.depth_multiplier();
617 std::unique_ptr<IFunction> func;
618 std::string func_name;
620 std::tie(func, func_name) = create_named_function<DepthwiseConvolutionLayer>(
621 std::string(
"DepthwiseConvolutionLayer"),
622 input, weights, biases, output,
conv_info, depth_multiplier, fused_act);
625 std::ostringstream qss;
628 qss <<
" Input QuantInfo: " << input->info()->quantization_info()
629 <<
" Weights QuantInfo: " << weights->info()->quantization_info()
630 <<
" Output QuantInfo: " << output->info()->quantization_info();
634 <<
" Type: " << func_name
635 <<
" Target: " << TargetInfo::TargetType
636 <<
" Data Type: " << input->info()->data_type()
637 <<
" Input shape: " << input->info()->tensor_shape()
638 <<
" Weights shape: " << weights->info()->tensor_shape()
639 <<
" Output shape: " << output->info()->tensor_shape()
640 <<
" Depth multiplier: " << depth_multiplier
644 return std::move(func);
656 template <
typename DepthToSpaceLayerFunction,
typename TargetInfo>
659 validate_node<TargetInfo>(node, 1 , 1 );
669 auto func = std::make_unique<DepthToSpaceLayerFunction>();
670 func->configure(input, output, node.block_shape());
675 <<
" Type: " << node.type()
676 <<
" Target: " << TargetInfo::TargetType
677 <<
" Data Type: " << input->info()->data_type()
678 <<
" Input shape: " << input->info()->tensor_shape()
679 <<
" Block Size: " << node.block_shape()
680 <<
" Output shape: " << output->info()->tensor_shape()
683 return std::move(func);
695 template <
typename DequantizationLayerFunction,
typename TargetInfo>
698 validate_node<TargetInfo>(node, 1 , 1 );
708 auto func = std::make_unique<DequantizationLayerFunction>();
709 func->configure(input, output);
714 <<
" Type: " << node.type()
715 <<
" Target: " << TargetInfo::TargetType
716 <<
" Data Type: " << input->info()->data_type()
717 <<
" Input shape: " << input->info()->tensor_shape()
718 <<
" Input quantization info: " << output->info()->quantization_info()
719 <<
" Output shape: " << output->info()->tensor_shape()
722 return std::move(func);
733 template <
typename DetectionOutputLayerFunction,
typename TargetInfo>
736 validate_node<TargetInfo>(node, 3 , 1 );
751 auto func = std::make_unique<DetectionOutputLayerFunction>();
752 func->configure(input0, input1, input2, output, detect_info);
757 <<
" Type: " << node.type()
758 <<
" Target: " << TargetInfo::TargetType
759 <<
" Data Type: " << input0->info()->data_type()
760 <<
" Input0 shape: " << input0->info()->tensor_shape()
761 <<
" Input1 shape: " << input1->info()->tensor_shape()
762 <<
" Input2 shape: " << input2->info()->tensor_shape()
763 <<
" Output shape: " << output->info()->tensor_shape()
764 <<
" DetectionOutputLayer info: " << detect_info
767 return std::move(func);
779 template <
typename DetectionPostProcessLayerFunction,
typename TargetInfo>
782 validate_node<TargetInfo>(node, 3 , 4 );
803 auto func = std::make_unique<DetectionPostProcessLayerFunction>();
804 func->configure(input0, input1, input2, output0, output1, output2, output3, detect_info);
809 <<
" Type: " << node.type()
810 <<
" Target: " << TargetInfo::TargetType
811 <<
" Data Type: " << input0->info()->data_type()
812 <<
" Input0 shape: " << input0->info()->tensor_shape()
813 <<
" Input1 shape: " << input1->info()->tensor_shape()
814 <<
" Input2 shape: " << input2->info()->tensor_shape()
815 <<
" Output0 shape: " << output0->info()->tensor_shape()
816 <<
" Output1 shape: " << output1->info()->tensor_shape()
817 <<
" Output2 shape: " << output2->info()->tensor_shape()
818 <<
" Output3 shape: " << output3->info()->tensor_shape()
819 <<
" DetectionPostProcessLayer info: " << detect_info
822 return std::move(func);
834 template <
typename EltwiseFunctions,
typename TargetInfo>
837 validate_node<TargetInfo>(node, 2 , 1 );
850 std::unique_ptr<IFunction> func =
nullptr;
851 std::string func_name;
854 std::tie(func, func_name) = create_named_function<typename EltwiseFunctions::Addition>(
855 std::string(
"ArithmeticAddition"),
856 input1, input2, output, convert_policy, act_info);
860 std::tie(func, func_name) = create_named_function<typename EltwiseFunctions::Subtraction>(
861 std::string(
"ArithmeticSubtraction"),
862 input1, input2, output, convert_policy, act_info);
866 std::tie(func, func_name) = create_named_function<typename EltwiseFunctions::Multiplication>(
867 std::string(
"PixelWiseMultiplication"),
868 input1, input2, output, 1.f, convert_policy, node.rounding_policy(), act_info);
872 std::tie(func, func_name) = create_named_function<typename EltwiseFunctions::Maximum>(
873 std::string(
"ElementwiseMaximum"),
874 input1, input2, output, act_info);
878 std::tie(func, func_name) = create_named_function<typename EltwiseFunctions::Division>(
879 std::string(
"ArithmeticDivision"),
880 input1, input2, output, act_info);
890 <<
" Type: " << node.type()
891 <<
" Target: " << TargetInfo::TargetType
892 <<
" Operation: " << func_name
893 <<
" Data Type: " << input1->info()->data_type()
894 <<
" Shape: " << input1->info()->tensor_shape()
897 return std::move(func);
909 template <
typename UnaryEltwiseFunctions,
typename TargetInfo>
912 validate_node<TargetInfo>(node, 1 , 1 );
922 std::unique_ptr<IFunction> func =
nullptr;
923 std::string func_name;
926 std::tie(func, func_name) = create_named_function<typename UnaryEltwiseFunctions::Exp>(
938 <<
" Type: " << node.type()
939 <<
" Target: " << TargetInfo::TargetType
940 <<
" Operation: " << func_name
941 <<
" Data Type: " << input->info()->data_type()
942 <<
" Shape: " << input->info()->tensor_shape()
945 return std::move(func);
957 template <
typename FlattenLayerFunction,
typename TargetInfo>
960 validate_node<TargetInfo>(node, 1 , 1 );
970 auto func = std::make_unique<FlattenLayerFunction>();
971 func->configure(input, output);
976 <<
" Type: " << node.type()
977 <<
" Target: " << TargetInfo::TargetType
978 <<
" Data Type: " << input->info()->data_type()
979 <<
" Input shape: " << input->info()->tensor_shape()
980 <<
" Output shape: " << output->info()->tensor_shape()
983 return std::move(func);
996 template <
typename FullyConnectedLayerFunction,
typename TargetInfo>
999 validate_node<TargetInfo>(node, 3 , 1 );
1015 auto func = std::make_unique<FullyConnectedLayerFunction>(mm, wm.get());
1016 func->configure(input, weights, biases, output, fc_info);
1021 std::ostringstream qss;
1024 qss <<
" Input QuantInfo: " << input->info()->quantization_info()
1025 <<
" Weights QuantInfo: " << weights->info()->quantization_info()
1026 <<
" Output QuantInfo: " << output->info()->quantization_info();
1030 <<
" Type: " << node.type()
1031 <<
" Target: " << TargetInfo::TargetType
1032 <<
" Data Type: " << input->info()->data_type()
1034 <<
" Input shape: " << input->info()->tensor_shape()
1035 <<
" Weights shape: " << weights->info()->tensor_shape()
1036 <<
" Output shape: " << output->info()->tensor_shape()
1039 return std::move(func);
1052 template <
typename GenerateProposalsLayerFunction,
typename TargetInfo>
1055 validate_node<TargetInfo>(node, 3 , 3 );
1073 auto func = std::make_unique<GenerateProposalsLayerFunction>(
get_memory_manager(ctx, TargetInfo::TargetType));
1074 func->configure(scores, deltas, anchors, proposals, scores_out, num_valid_proposals, info);
1078 <<
" Target " << TargetInfo::TargetType
1079 <<
" Data Type: " << scores->info()->data_type()
1080 <<
" Scores shape: " << scores->info()->tensor_shape()
1081 <<
" Deltas shape: " << deltas->info()->tensor_shape()
1082 <<
" Anchors shape: " << anchors->info()->tensor_shape()
1083 <<
" Proposals shape: " << proposals->info()->tensor_shape()
1084 <<
" Num valid proposals shape: " << num_valid_proposals->info()->tensor_shape()
1085 <<
" Scores Out shape: " << scores_out->info()->tensor_shape()
1088 return std::move(func);
1101 template <
typename L2NormalizeLayerFunction,
typename TargetInfo>
1104 validate_node<TargetInfo>(node, 1 , 1 );
1109 int axis = node.axis();
1110 float epsilon = node.epsilon();
1117 auto func = std::make_unique<L2NormalizeLayerFunction>(mm);
1118 func->configure(input, output, axis, epsilon);
1123 <<
" Type: " << node.type()
1124 <<
" Target: " << TargetInfo::TargetType
1125 <<
" Data Type: " << input->info()->data_type()
1126 <<
" Input shape: " << input->info()->tensor_shape()
1127 <<
" Output shape: " << output->info()->tensor_shape()
1128 <<
" Axis: " << axis
1129 <<
" Epsilon: " << epsilon
1132 return std::move(func);
1145 template <
typename NormalizationLayerFunction,
typename TargetInfo>
1150 validate_node<TargetInfo>(node, 1 , 1 );
1160 auto func = std::make_unique<NormalizationLayerFunction>();
1161 func->configure(input, output, norm_info);
1166 <<
" Type: " << node.type()
1167 <<
" Target: " << TargetInfo::TargetType
1168 <<
" Data Type: " << input->info()->data_type()
1169 <<
" Input shape: " << input->info()->tensor_shape()
1170 <<
" Output shape: " << output->info()->tensor_shape()
1171 <<
" Normalization info: " << norm_info.type()
1174 return std::move(func);
1186 template <
typename NormalizePlanarYUVLayerFunction,
typename TargetInfo>
1189 validate_node<TargetInfo>(node, 3 , 1 );
1202 auto func = std::make_unique<NormalizePlanarYUVLayerFunction>();
1203 func->configure(input, output, mean, std);
1208 <<
" Type: " << node.type()
1209 <<
" Target: " << TargetInfo::TargetType
1210 <<
" Data Type: " << input->info()->data_type()
1211 <<
" Shape: " << input->info()->tensor_shape()
1214 return std::move(func);
1226 template <
typename PadLayerFunction,
typename TargetInfo>
1229 validate_node<TargetInfo>(node, 1 , 1 );
1235 const PixelValue pad_value = node.pad_value();
1240 auto func = std::make_unique<PadLayerFunction>();
1241 func->configure(input, output, padding, pad_value);
1246 <<
" Type: " << node.type()
1247 <<
" Target: " << TargetInfo::TargetType
1248 <<
" Data Type: " << input->info()->data_type()
1249 <<
" Input shape: " << input->info()->tensor_shape()
1250 <<
" Output shape: " << output->info()->tensor_shape()
1253 return std::move(func);
1265 template <
typename PermuteLayerFunction,
typename TargetInfo>
1268 validate_node<TargetInfo>(node, 1 , 1 );
1278 auto func = std::make_unique<PermuteLayerFunction>();
1279 func->configure(input, output, perm);
1284 <<
" Type: " << node.type()
1285 <<
" Target: " << TargetInfo::TargetType
1286 <<
" Data Type: " << input->info()->data_type()
1287 <<
" Input shape: " << input->info()->tensor_shape()
1288 <<
" Output shape: " << output->info()->tensor_shape()
1289 <<
" Permutation vector: " << perm
1292 return std::move(func);
1304 template <
typename PoolingLayerFunction,
typename TargetInfo>
1307 validate_node<TargetInfo>(node, 1 , 1 );
1317 auto func = std::make_unique<PoolingLayerFunction>();
1318 func->configure(input, output, pool_info);
1323 <<
" Type: " << node.type()
1324 <<
" Target: " << TargetInfo::TargetType
1325 <<
" Data Type: " << input->info()->data_type()
1326 <<
" Input shape: " << input->info()->tensor_shape()
1327 <<
" Output shape: " << output->info()->tensor_shape()
1328 <<
" Pooling info: " << pool_info.pool_type
1331 return std::move(func);
1343 template <
typename PReluFunction,
typename TargetInfo>
1346 validate_node<TargetInfo>(node, 2 , 1 );
1356 auto func = std::make_unique<PReluFunction>();
1357 func->configure(input, alpha, output);
1362 <<
" Type: " << node.type()
1363 <<
" Target: " << TargetInfo::TargetType
1364 <<
" Data Type: " << input->info()->data_type()
1365 <<
" Input shape: " << input->info()->tensor_shape()
1366 <<
" Output shape: " << output->info()->tensor_shape()
1369 return std::move(func);
1380 template <
typename TargetInfo>
1383 validate_node<TargetInfo>(node, 1 , 1 );
1392 <<
" Type: " << node.type()
1393 <<
" Target: " << TargetInfo::TargetType
1394 <<
" Data Type: " << input->info()->data_type()
1395 <<
" Input shape: " << input->info()->tensor_shape()
1410 template <
typename PriorBoxLayerFunction,
typename TargetInfo>
1413 validate_node<TargetInfo>(node, 2 , 1 );
1425 auto func = std::make_unique<PriorBoxLayerFunction>();
1426 func->configure(input0, input1, output, prior_info);
1431 <<
" Type: " << node.type()
1432 <<
" Target: " << TargetInfo::TargetType
1433 <<
" Data Type: " << input0->info()->data_type()
1434 <<
" Input0 shape: " << input0->info()->tensor_shape()
1435 <<
" Input1 shape: " << input1->info()->tensor_shape()
1436 <<
" Output shape: " << output->info()->tensor_shape()
1437 <<
" PriorBoxLayer info: " << prior_info
1440 return std::move(func);
1452 template <
typename QuantizationLayerFunction,
typename TargetInfo>
1455 validate_node<TargetInfo>(node, 1 , 1 );
1464 auto func = std::make_unique<QuantizationLayerFunction>();
1465 func->configure(input, output);
1470 <<
" Type: " << node.type()
1471 <<
" Target: " << TargetInfo::TargetType
1472 <<
" Data Type: " << input->info()->data_type()
1473 <<
" Input shape: " << input->info()->tensor_shape()
1474 <<
" Output shape: " << output->info()->tensor_shape()
1477 return std::move(func);
1490 template <
typename ReductionOperationFunction,
typename TargetInfo>
1493 validate_node<TargetInfo>(node, 1 , 1 );
1499 int axis = node.axis();
1500 bool keep_dims = node.keep_dims();
1505 auto func = std::make_unique<ReductionOperationFunction>(
get_memory_manager(ctx, TargetInfo::TargetType));
1506 func->configure(input, output, axis, op, keep_dims);
1511 <<
" Type: " << node.type()
1512 <<
" Target: " << TargetInfo::TargetType
1513 <<
" Data Type: " << input->info()->data_type()
1514 <<
" Input shape: " << input->info()->tensor_shape()
1515 <<
" Output shape: " << output->info()->tensor_shape()
1516 <<
" Operation: " << op
1517 <<
" Axis: " << axis
1518 <<
" Keep dimensions:" << keep_dims
1521 return std::move(func);
1533 template <
typename ReorgLayerFunction,
typename TargetInfo>
1536 validate_node<TargetInfo>(node, 1 , 1 );
1545 auto func = std::make_unique<ReorgLayerFunction>();
1546 func->configure(input, output, node.stride());
1551 <<
" Type: " << node.type()
1552 <<
" Target: " << TargetInfo::TargetType
1553 <<
" Data Type: " << input->info()->data_type()
1554 <<
" Input shape: " << input->info()->tensor_shape()
1555 <<
" Output shape: " << output->info()->tensor_shape()
1558 return std::move(func);
1570 template <
typename ReshapeLayerFunction,
typename TargetInfo>
1573 validate_node<TargetInfo>(node, 1 , 1 );
1582 auto func = std::make_unique<ReshapeLayerFunction>();
1583 func->configure(input, output);
1588 <<
" Type: " << node.type()
1589 <<
" Target: " << TargetInfo::TargetType
1590 <<
" Data Type: " << input->info()->data_type()
1591 <<
" Input shape: " << input->info()->tensor_shape()
1592 <<
" Output shape: " << output->info()->tensor_shape()
1595 return std::move(func);
1607 template <
typename ResizeLayerFunction,
typename TargetInfo>
1610 validate_node<TargetInfo>(node, 1 , 1 );
1620 auto func = std::make_unique<ResizeLayerFunction>();
1626 <<
" Type: " << node.type()
1627 <<
" Target: " << TargetInfo::TargetType
1628 <<
" Data Type: " << input->info()->data_type()
1629 <<
" Input shape: " << input->info()->tensor_shape()
1630 <<
" Output shape: " << output->info()->tensor_shape()
1631 <<
" Interpolation: " << policy
1634 return std::move(func);
1646 template <
typename ROIAlignLayerFunction,
typename TargetInfo>
1649 validate_node<TargetInfo>(node, 2 , 1 );
1662 auto func = std::make_unique<ROIAlignLayerFunction>();
1664 func->configure(input, rois, output, pool_info);
1669 <<
" Type: " << node.type()
1670 <<
" Target: " << TargetInfo::TargetType
1671 <<
" Data Type: " << input->info()->data_type()
1672 <<
" Input shape: " << input->info()->tensor_shape()
1673 <<
" Output shape: " << output->info()->tensor_shape()
1674 <<
" ROIs shape: " << rois->info()->tensor_shape()
1679 return std::move(func);
1691 template <
typename SliceLayerFunction,
typename TargetInfo>
1694 validate_node<TargetInfo>(node, 1 , 1 );
1703 auto func = std::make_unique<SliceLayerFunction>();
1704 func->configure(input, output, node.starts(), node.ends());
1709 <<
" Type: " << node.type()
1710 <<
" Target: " << TargetInfo::TargetType
1711 <<
" Data Type: " << input->info()->data_type()
1712 <<
" Input shape: " << input->info()->tensor_shape()
1713 <<
" Output shape: " << output->info()->tensor_shape()
1716 return std::move(func);
1729 template <
typename SoftmaxLayerFunction,
typename TargetInfo>
1732 validate_node<TargetInfo>(node, 1 , 1 );
1737 const float beta = node.beta();
1742 auto func = std::make_unique<SoftmaxLayerFunction>(
get_memory_manager(ctx, TargetInfo::TargetType));
1743 func->configure(input, output, beta);
1748 <<
" Type: " << node.type()
1749 <<
" Target: " << TargetInfo::TargetType
1750 <<
" Data Type: " << input->info()->data_type()
1751 <<
" Input shape: " << input->info()->tensor_shape()
1752 <<
" Output shape: " << output->info()->tensor_shape()
1755 return std::move(func);
1767 template <
typename StackLayerFunction,
typename TargetInfo>
1774 std::vector<typename TargetInfo::TensorType *> inputs;
1775 for(
unsigned int i = 0; i < node.
num_inputs(); ++i)
1777 inputs.push_back(get_backing_tensor<TargetInfo>(node.
input(i)));
1780 const int axis = node.
axis();
1783 auto func = std::make_unique<StackLayerFunction>();
1784 func->configure(inputs, axis, output);
1789 <<
" Type: " << node.
type()
1790 <<
" Target: " << TargetInfo::TargetType
1791 <<
" Data Type: " << output->info()->data_type()
1792 <<
" Inputs shape: " << inputs[0]->info()->tensor_shape()
1793 <<
" Output shape: " << output->info()->tensor_shape()
1794 <<
" Num Inputs: " << inputs.size()
1795 <<
" Axis: " << axis
1798 return std::move(func);
1810 template <
typename Str
idedSliceLayerFunction,
typename TargetInfo>
1813 validate_node<TargetInfo>(node, 1 , 1 );
1827 auto func = std::make_unique<StridedSliceLayerFunction>();
1833 <<
" Type: " << node.type()
1834 <<
" Target: " << TargetInfo::TargetType
1835 <<
" Data Type: " << input->info()->data_type()
1836 <<
" Input shape: " << input->info()->tensor_shape()
1837 <<
" Output shape: " << output->info()->tensor_shape()
1840 return std::move(func);
std::unique_ptr< IFunction > create_normalization_layer(NormalizationLayerNode &node, GraphContext &ctx)
Create a backend normalization layer function.
std::unique_ptr< IFunction > create_dequantization_layer(DequantizationLayerNode &node)
Create a backend dequantize layer function.
std::string name() const
Returns node's name.
Class describing the value of a pixel for any image format.
InterpolationPolicy
Interpolation method.
std::unique_ptr< IFunction > create_arg_min_max_layer(ArgMinMaxLayerNode &node)
Creates a backend argminmax layer function.
Generate Proposals Information class.
EltwiseOperation
Supported Element-wise operations.
std::unique_ptr< IFunction > create_slice_layer(SliceLayerNode &node)
Create a backend slice layer function.
Batch Normalization Layer node.
Fused Depthwise Convolution Batch Normalization node.
Normalization Layer node.
std::unique_ptr< IFunction > create_eltwise_layer(EltwiseLayerNode &node)
Create a backend element-wise operation layer function.
bool enabled() const
Check if initialised.
std::vector< PaddingInfo > PaddingList
List of padding information.
ReductionOperation
Available reduction operations.
DataLayoutDimension concatenation_axis() const
Concatenation axis parameter accessor.
ITensorHandle * handle()
Backend tensor handle accessor.
std::unique_ptr< IFunction > create_batch_normalization_layer(BatchNormalizationLayerNode &node)
Create a backend batch normalization layer function.
std::unique_ptr< IFunction > create_depth_to_space_layer(DepthToSpaceLayerNode &node)
Create a backend depth to space layer function.
#define ARM_COMPUTE_ERROR(msg)
Print the given message then throw an std::runtime_error.
std::unique_ptr< IFunction > create_fused_convolution_batch_normalization_layer(FusedConvolutionBatchNormalizationNode &node, GraphContext &ctx)
Create a backend batch normalization layer function.
Target assigned_target() const
Returns assigned target for this node.
std::unique_ptr< IFunction > create_prelu_layer(PReluLayerNode &node)
Create a backend PRelu layer function.
std::unique_ptr< IFunction > create_depthwise_convolution_layer(DepthwiseConvolutionLayerNode &node)
Create a backend layer depth-wise convolution function.
size_t num_outputs() const
Returns number of outputs of the node.
std::unique_ptr< IFunction > create_resize_layer(ResizeLayerNode &node)
Create a backend resize layer function.
Wrapper function to first apply {NE, CL}BatchNormalizationLayer on the weights and then run {NE...
Normalization Layer Information class.
Batch Normalization Layer node.
std::unique_ptr< IFunction > create_permute_layer(PermuteLayerNode &node)
Create a backend permute layer function.
#define ARM_COMPUTE_ERROR_ON(cond)
If the condition is true then an error message is printed and an exception thrown.
std::unique_ptr< IFunction > create_generate_proposals_layer(GenerateProposalsLayerNode &node, GraphContext &ctx)
Create a backend generate proposals layer function.
NodeType type() const override
Returns node's type.
std::unique_ptr< IFunction > create_l2_normalize_layer(L2NormalizeLayerNode &node, GraphContext &ctx)
Create a backend l2 normalization layer function.
const DataLayout data_layout
Fully connected layer info.
Fast math enabled for Convolution layer.
std::unique_ptr< IFunction > create_flatten_layer(FlattenLayerNode &node)
Create a backend flatten layer function.
unsigned int pooled_width() const
Get the pooled width of the layer.
Wrapper function to first apply {NE, CL}BatchNormalizationLayer on the weights and then run {NE...
std::unique_ptr< IFunction > create_pad_layer(PadLayerNode &node)
Create a backend pad layer function.
Activation Layer Information class.
#define ARM_COMPUTE_LOG_GRAPH_INFO(x)
std::unique_ptr< arm_compute::IFunction > create_stack_layer(StackLayerNode &node)
Create a backend layer stack function.
Copyright (c) 2017-2021 Arm Limited.
Batch Normalization node.
Samples are taken at pixel center.
Convolution Layer Weights Information class.
std::unique_ptr< IFunction > create_softmax_layer(SoftmaxLayerNode &node, GraphContext &ctx)
Create a backend softmax layer function.
1 channel, 1 S32 per channel
TensorDescriptor & desc()
TensorInfo metadata accessor.
std::unique_ptr< IFunction > create_fused_depthwise_convolution_batch_normalization_layer(FusedDepthwiseConvolutionBatchNormalizationNode &node, GraphContext &ctx)
Create a backend fused depthwise convolution batch normalization layer function.
std::string to_string(const ROIPoolingLayerInfo &pool_info)
Formatted output of the ROIPoolingInfo type.
std::unique_ptr< IFunction > create_convolution_layer(ConvolutionLayerNode &node, GraphContext &ctx)
Create a backend convolution layer function.
#define ARM_COMPUTE_UNUSED(...)
To avoid unused variables warnings.
std::unique_ptr< IFunction > create_roi_align_layer(ROIAlignLayerNode &node)
Create a backend ROI align layer function.
bool is_enabled() const
Enabled parameter accessor.
Tensor * output(size_t idx) const
Returns the tensor of a given output of the node.
#define ARM_COMPUTE_ERROR_ON_MSG(cond, msg)
const unsigned int num_groups
Pooling Layer Information struct.
void validate_node(const INode &node, size_t num_expected_inputs, size_t num_expected_outputs)
std::unique_ptr< IFunction > create_reduction_operation_layer(ReductionLayerNode &node, GraphContext &ctx)
Create a backend reduction operation layer function.
std::unique_ptr< IFunction > create_priorbox_layer(PriorBoxLayerNode &node)
Create a backend priorbox layer function.
NodeID id() const
Returns node's ID.
std::unique_ptr< IFunction > create_detection_output_layer(DetectionOutputLayerNode &node)
Create a backend detection output layer function.
Channel Shuffle Layer node.
Padding and stride information class.
Concatenation Layer node.
std::unique_ptr< IFunction > create_detection_post_process_layer(DetectionPostProcessLayerNode &node)
Create a backend detection post process layer function.
Tensor handle interface object.
std::unique_ptr< IFunction > create_deconvolution_layer(DeconvolutionLayerNode &node, GraphContext &ctx)
Create a backend deconvolution layer function.
Reduction Operation node.
std::unique_ptr< IFunction > create_unary_eltwise_layer(UnaryEltwiseLayerNode &node)
Create a backend unary element-wise operation layer function.
bool is_data_type_quantized_asymmetric(DataType dt)
Check if a given data type is of asymmetric quantized type.
bool is_in_place_operation(void *input, void *output)
Checks if an operation is in place.
Strides of an item in bytes.
std::unique_ptr< IFunction > create_print_layer(PrintLayerNode &node)
Create a backend print layer function.
Detection Output layer info.
DetectionPostProcess Layer node.
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)
std::unique_ptr< IFunction > create_fully_connected_layer(FullyConnectedLayerNode &node, GraphContext &ctx)
Create a backend fully connected layer function.
std::unique_ptr< IFunction > create_activation_layer(ActivationLayerNode &node)
Creates a backend activation layer function.
DetectionOutput Layer node.
int axis() const
Stack axis parameter accessor.
int32_t shrink_axis_mask() const
std::unique_ptr< IFunction > create_strided_slice_layer(StridedSliceLayerNode &node)
Create a backend slice layer function.
unsigned int pooled_height() const
Get the pooled height of the layer.
ROI Pooling Layer Information class.
Class for specifying the size of an image or rectangle.
std::unique_ptr< IFunction > create_quantization_layer(QuantizationLayerNode &node)
Create a backend quantization layer function.
Unary Eltwise Layer node.
std::shared_ptr< IMemoryManager > get_memory_manager(GraphContext &ctx, Target target)
Returns the memory manager for a given target.
std::unique_ptr< IFunction > create_normalize_planar_yuv_layer(NormalizePlanarYUVLayerNode &node)
Create a backend normalize planar YUV layer function.
#define ARM_COMPUTE_LOG_GRAPH_VERBOSE(x)
ConvolutionMethod
Supported Convolution layer methods.
std::unique_ptr< IFunction > create_bounding_box_transform_layer(BoundingBoxTransformLayerNode &node)
Create a backend bounding box transform layer function.
Detection Output layer info.
size_t num_inputs() const
Returns number of inputs of the node.
Generate Proposals Layer node.
TargetInfo::TensorType * get_backing_tensor(arm_compute::graph::Tensor *tensor)
Returns backing tensor of a given tensor.
Deconvolution Layer node.
Fully Connected Layer node.
Depthwise Convolution Layer node.
Winograd based convolution.
ActivationFunction activation() const
Get the type of activation function.
virtual NodeType type() const =0
Returns node's type.
Arithmetic multiplication.
std::shared_ptr< IWeightsManager > get_weights_manager(GraphContext &ctx, Target target)
Returns the weights manager for a given target.
Tensor * input(size_t idx) const
Returns the tensor of a given input of the node.
NodeType type() const override
Returns node's type.
DataLayout layout
Data layout.
std::unique_ptr< IFunction > create_pooling_layer(PoolingLayerNode &node)
Create a backend pooling layer function.
DataLayout
[DataLayout enum definition]
std::unique_ptr< arm_compute::IFunction > create_concatenate_layer(ConcatenateLayerNode &node)
Create a backend layer concatenate function.
int32_t begin_mask() const
ConvertPolicy
Policy to handle overflow.
std::unique_ptr< IFunction > create_reshape_layer(ReshapeLayerNode &node)
Create a backend reshape layer function.
size_t get_dimension_idx(DataLayout data_layout, const DataLayoutDimension data_layout_dimension)
Get index of a tensor's given dimension depending on its layout.
std::unique_ptr< IFunction > create_reorg_layer(ReorgLayerNode &node)
Create a backend reorg layer function.
std::unique_ptr< IFunction > create_channel_shuffle_layer(ChannelShuffleLayerNode &node)
Create a backend channel shuffle layer function.
UnaryEltwiseOperation
Supported Unary Element-wise operations.