blob: 96236b66c3e23fc83fb1cd2f5d7c9b40c1650b76 [file] [log] [blame]
Georgios Pinitas28705162018-03-21 20:10:53 +00001/*
Giuseppe Rossinibb365de2019-02-15 10:24:47 +00002 * Copyright (c) 2018-2019 ARM Limited.
Georgios Pinitas28705162018-03-21 20:10:53 +00003 *
4 * SPDX-License-Identifier: MIT
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to
8 * deal in the Software without restriction, including without limitation the
9 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10 * sell copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in all
14 * copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 * SOFTWARE.
23 */
Georgios Pinitasd9eb2752018-04-03 13:44:29 +010024#include "arm_compute/graph/backends/NEON/NENodeValidator.h"
Georgios Pinitas28705162018-03-21 20:10:53 +000025
Georgios Pinitasd9eb2752018-04-03 13:44:29 +010026#include "arm_compute/graph/backends/ValidateHelpers.h"
27#include "arm_compute/graph/nodes/Nodes.h"
Georgios Pinitas28705162018-03-21 20:10:53 +000028
29#include "arm_compute/core/utils/misc/Cast.h"
Isabella Gottardi7234ed82018-11-27 08:51:10 +000030#include "arm_compute/runtime/CPP/CPPFunctions.h"
Georgios Pinitas28705162018-03-21 20:10:53 +000031#include "arm_compute/runtime/NEON/NEFunctions.h"
32
33using namespace arm_compute::utils::cast;
34
35namespace arm_compute
36{
Georgios Pinitasd9eb2752018-04-03 13:44:29 +010037namespace graph
Georgios Pinitas28705162018-03-21 20:10:53 +000038{
39namespace backends
40{
41Status NENodeValidator::validate(INode *node)
42{
43 if(node == nullptr)
44 {
45 return Status{};
46 }
47
48 NodeType type = node->type();
49 switch(type)
50 {
Manuel Bottinid2048ce2018-10-23 17:00:42 +010051 case NodeType::BoundingBoxTransformLayer:
52 return ARM_COMPUTE_CREATE_ERROR(arm_compute::ErrorCode::RUNTIME_ERROR, "Unsupported operation : BoundingBoxTransformLayer");
Georgios Pinitas087eaf62018-05-16 15:52:35 +010053 case NodeType::ChannelShuffleLayer:
Georgios Pinitasf1adf112018-11-02 12:54:18 +000054 return detail::validate_channel_shuffle_layer<NEChannelShuffleLayer>(*polymorphic_downcast<ChannelShuffleLayerNode *>(node));
Georgios Pinitas28705162018-03-21 20:10:53 +000055 case NodeType::ConvolutionLayer:
56 return detail::validate_convolution_layer<NEConvolutionLayer,
57 NEDirectConvolutionLayer,
58 NEGEMMConvolutionLayer,
Georgios Pinitas9fb11592018-04-26 20:34:58 +010059 NEWinogradConvolutionLayer>(*polymorphic_downcast<ConvolutionLayerNode *>(node));
Georgios Pinitas28705162018-03-21 20:10:53 +000060 case NodeType::DepthwiseConvolutionLayer:
61 return detail::validate_depthwise_convolution_layer<NEDepthwiseConvolutionLayer,
62 NEDepthwiseConvolutionLayer3x3>(*polymorphic_downcast<DepthwiseConvolutionLayerNode *>(node));
Isabella Gottardi7234ed82018-11-27 08:51:10 +000063 case NodeType::DetectionOutputLayer:
64 return detail::validate_detection_output_layer<CPPDetectionOutputLayer>(*polymorphic_downcast<DetectionOutputLayerNode *>(node));
Michele Di Giorgioc30b6682018-09-12 17:44:08 +010065 case NodeType::NormalizePlanarYUVLayer:
66 return ARM_COMPUTE_CREATE_ERROR(arm_compute::ErrorCode::RUNTIME_ERROR, "Unsupported operation : NormalizePlanarYUVLayer");
Michele Di Giorgio4bb17332018-09-26 13:56:51 +010067 case NodeType::PadLayer:
68 return ARM_COMPUTE_CREATE_ERROR(arm_compute::ErrorCode::RUNTIME_ERROR, "Unsupported operation : PadLayer");
Georgios Pinitas57c48242018-08-02 13:41:49 +010069 case NodeType::PermuteLayer:
70 return detail::validate_permute_layer<NEPermute>(*polymorphic_downcast<PermuteLayerNode *>(node));
Pablo Tello32521432018-11-15 14:43:10 +000071 case NodeType::PriorBoxLayer:
72 return detail::validate_priorbox_layer<NEPriorBoxLayer>(*polymorphic_downcast<PriorBoxLayerNode *>(node));
Gian Marco Iodice23e24792018-09-07 15:32:14 +010073 case NodeType::ReorgLayer:
74 return detail::validate_reorg_layer<NEReorgLayer>(*polymorphic_downcast<ReorgLayerNode *>(node));
Manuel Bottini3f9d4d72018-10-19 14:04:42 +010075 case NodeType::ROIAlignLayer:
76 return ARM_COMPUTE_CREATE_ERROR(arm_compute::ErrorCode::RUNTIME_ERROR, "Unsupported operation : ROIAlignLayer");
Michele Di Giorgioc30b6682018-09-12 17:44:08 +010077 case NodeType::SliceLayer:
78 return ARM_COMPUTE_CREATE_ERROR(arm_compute::ErrorCode::RUNTIME_ERROR, "Unsupported operation : SliceLayer");
Michalis Spyrou4e1c3f32018-09-20 17:14:03 +010079 case NodeType::UpsampleLayer:
Michalis Spyrou7c9541c2018-09-20 17:40:04 +010080 return detail::validate_upsample_layer<NEUpsampleLayer>(*polymorphic_downcast<UpsampleLayerNode *>(node));
Michalis Spyrou96f67692018-09-13 11:39:28 +010081 case NodeType::YOLOLayer:
Michalis Spyroue22aa132018-09-13 10:35:33 +010082 return detail::validate_yolo_layer<NEYOLOLayer>(*polymorphic_downcast<YOLOLayerNode *>(node));
Georgios Pinitas28705162018-03-21 20:10:53 +000083 default:
84 return Status{};
85 }
86}
87} // namespace backends
Georgios Pinitasd9eb2752018-04-03 13:44:29 +010088} // namespace graph
Michele Di Giorgioc30b6682018-09-12 17:44:08 +010089} // namespace arm_compute