diff options
Diffstat (limited to 'arm_compute/graph')
-rw-r--r-- | arm_compute/graph/GraphBuilder.h | 11 | ||||
-rw-r--r-- | arm_compute/graph/backends/FunctionHelpers.h | 47 | ||||
-rw-r--r-- | arm_compute/graph/backends/ValidateHelpers.h | 22 | ||||
-rw-r--r-- | arm_compute/graph/frontend/Layers.h | 26 | ||||
-rw-r--r-- | arm_compute/graph/nodes/Nodes.h | 1 | ||||
-rw-r--r-- | arm_compute/graph/nodes/NodesFwd.h | 1 | ||||
-rw-r--r-- | arm_compute/graph/nodes/UpsampleLayerNode.h | 74 |
7 files changed, 1 insertions, 181 deletions
diff --git a/arm_compute/graph/GraphBuilder.h b/arm_compute/graph/GraphBuilder.h index 54bb33d1a4..8c727e3c8e 100644 --- a/arm_compute/graph/GraphBuilder.h +++ b/arm_compute/graph/GraphBuilder.h @@ -571,17 +571,6 @@ public: * @return Node ID of the created node, EmptyNodeID in case of error */ static NodeID add_strided_slice_node(Graph &g, NodeParams params, NodeIdxPair input, Coordinates &starts, Coordinates &ends, BiStrides &strides, StridedSliceLayerInfo info); - /** Adds an upsample layer to the graph - * - * @param[in] g Graph to add the node to - * @param[in] params Common node parameters - * @param[in] input Input to the yolo layer node as a NodeID-Index pair - * @param[in] info Upsample layer stride info - * @param[in] upsampling_policy Upsampling policy used - * - * @return Node ID of the created node, EmptyNodeID in case of error - */ - static NodeID add_upsample_node(Graph &g, NodeParams params, NodeIdxPair input, Size2D info, InterpolationPolicy upsampling_policy); /** Adds a yolo layer to the graph * * @param[in] g Graph to add the node to diff --git a/arm_compute/graph/backends/FunctionHelpers.h b/arm_compute/graph/backends/FunctionHelpers.h index 18fdb9f3bb..873957e6b7 100644 --- a/arm_compute/graph/backends/FunctionHelpers.h +++ b/arm_compute/graph/backends/FunctionHelpers.h @@ -1619,7 +1619,7 @@ std::unique_ptr<IFunction> create_resize_layer(ResizeLayerNode &node) // Create and configure function auto func = std::make_unique<ResizeLayerFunction>(); - func->configure(input, output, ScaleKernelInfo{ policy, BorderMode::CONSTANT }); + func->configure(input, output, ScaleKernelInfo{ policy, BorderMode::CONSTANT, PixelValue(), SamplingPolicy::CENTER, false, false }); // Log info ARM_COMPUTE_LOG_GRAPH_INFO("Instantiated " @@ -1840,51 +1840,6 @@ std::unique_ptr<IFunction> create_strided_slice_layer(StridedSliceLayerNode &nod return RETURN_UNIQUE_PTR(func); } - -/** Create a backend Upsample layer function - * - * @tparam UpsampleLayerFunction Backend Upsample function - * @tparam TargetInfo Target-specific information - * - * @param[in] node Node to create the backend function for - * @param[in] ctx Graph context - * - * @return Backend Upsample layer function - */ -template <typename UpsampleLayerFunction, typename TargetInfo> -std::unique_ptr<IFunction> create_upsample_layer(UpsampleLayerNode &node, GraphContext &ctx) -{ - ARM_COMPUTE_UNUSED(ctx); - validate_node<TargetInfo>(node, 1 /* expected inputs */, 1 /* expected outputs */); - - // Extract IO and info - typename TargetInfo::TensorType *input = get_backing_tensor<TargetInfo>(node.input(0)); - typename TargetInfo::TensorType *output = get_backing_tensor<TargetInfo>(node.output(0)); - const Size2D info = node.info(); - const InterpolationPolicy upsampling_policy = node.upsampling_policy(); - ARM_COMPUTE_ERROR_ON(upsampling_policy != InterpolationPolicy::NEAREST_NEIGHBOR); - ARM_COMPUTE_ERROR_ON(info.x() != 2 || info.y() != 2); - ARM_COMPUTE_ERROR_ON(input == nullptr); - ARM_COMPUTE_ERROR_ON(output == nullptr); - - // Create and configure function - auto func = std::make_unique<UpsampleLayerFunction>(); - func->configure(input, output, info, upsampling_policy); - - // Log info - ARM_COMPUTE_LOG_GRAPH_INFO("Instantiated " - << node.name() - << " Type: " << node.type() - << " Target: " << TargetInfo::TargetType - << " Data Type: " << input->info()->data_type() - << " Input shape: " << input->info()->tensor_shape() - << " Output shape: " << output->info()->tensor_shape() - << " Strides: " << info - << " Upsampling policy: " << upsampling_policy - << std::endl); - - return RETURN_UNIQUE_PTR(func); -} } // namespace detail } // namespace backends } // namespace graph diff --git a/arm_compute/graph/backends/ValidateHelpers.h b/arm_compute/graph/backends/ValidateHelpers.h index df1c17697b..f8cb1c12e9 100644 --- a/arm_compute/graph/backends/ValidateHelpers.h +++ b/arm_compute/graph/backends/ValidateHelpers.h @@ -654,28 +654,6 @@ Status validate_strided_slice_layer(StridedSliceLayerNode &node) return StridedSliceLayer::validate(input, output, starts, ends, strides, info.begin_mask(), info.end_mask(), info.shrink_axis_mask()); } -/** Validates a Upsample layer node - * - * @tparam UpsampleLayer Upsample layer type - * - * @param[in] node Node to validate - * - * @return Status - */ -template <typename UpsampleLayer> -Status validate_upsample_layer(UpsampleLayerNode &node) -{ - ARM_COMPUTE_LOG_GRAPH_VERBOSE("Validating UpsampleLayer node with ID : " << node.id() << " and Name: " << node.name() << std::endl); - ARM_COMPUTE_RETURN_ERROR_ON(node.num_inputs() != 1); - ARM_COMPUTE_RETURN_ERROR_ON(node.num_outputs() != 1); - - // Extract input and output - arm_compute::ITensorInfo *input = detail::get_backing_tensor_info(node.input(0)); - arm_compute::ITensorInfo *output = get_backing_tensor_info(node.output(0)); - - // Validate function - return UpsampleLayer::validate(input, output, node.info(), node.upsampling_policy()); -} /** Validates a element-wise layer node * * @param[in] node Node to validate diff --git a/arm_compute/graph/frontend/Layers.h b/arm_compute/graph/frontend/Layers.h index dfe7842aa1..c4de4013b2 100644 --- a/arm_compute/graph/frontend/Layers.h +++ b/arm_compute/graph/frontend/Layers.h @@ -1459,32 +1459,6 @@ private: StridedSliceLayerInfo _info; }; -/** Upsample Layer */ -class UpsampleLayer final : public ILayer -{ -public: - /** Construct a Upsample layer. - * - * @param[in] info Stride info - * @param[in] upsampling_policy Upsampling policy - */ - UpsampleLayer(Size2D info, InterpolationPolicy upsampling_policy) - : _info(info), _upsampling_policy(upsampling_policy) - { - } - - NodeID create_layer(IStream &s) override - { - NodeParams common_params = { name(), s.hints().target_hint }; - NodeIdxPair input = { s.tail_node(), 0 }; - return GraphBuilder::add_upsample_node(s.graph(), common_params, input, _info, _upsampling_policy); - } - -private: - Size2D _info; - InterpolationPolicy _upsampling_policy; -}; - /** YOLO Layer */ class YOLOLayer final : public ILayer { diff --git a/arm_compute/graph/nodes/Nodes.h b/arm_compute/graph/nodes/Nodes.h index 9a6f982da7..edb1876722 100644 --- a/arm_compute/graph/nodes/Nodes.h +++ b/arm_compute/graph/nodes/Nodes.h @@ -67,6 +67,5 @@ #include "arm_compute/graph/nodes/SplitLayerNode.h" #include "arm_compute/graph/nodes/StackLayerNode.h" #include "arm_compute/graph/nodes/StridedSliceLayerNode.h" -#include "arm_compute/graph/nodes/UpsampleLayerNode.h" #endif /* ARM_COMPUTE_GRAPH_NODES_H */ diff --git a/arm_compute/graph/nodes/NodesFwd.h b/arm_compute/graph/nodes/NodesFwd.h index b46b5d5f09..485361296a 100644 --- a/arm_compute/graph/nodes/NodesFwd.h +++ b/arm_compute/graph/nodes/NodesFwd.h @@ -73,7 +73,6 @@ class SliceLayerNode; class SplitLayerNode; class StackLayerNode; class StridedSliceLayerNode; -class UpsampleLayerNode; } // namespace graph } // namespace arm_compute #endif /* ARM_COMPUTE_GRAPH_NODES_FWD_H */ diff --git a/arm_compute/graph/nodes/UpsampleLayerNode.h b/arm_compute/graph/nodes/UpsampleLayerNode.h deleted file mode 100644 index 8e43ac23f3..0000000000 --- a/arm_compute/graph/nodes/UpsampleLayerNode.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (c) 2018-2019 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#ifndef ARM_COMPUTE_GRAPH_UPSAMPLE_LAYER_NODE_H -#define ARM_COMPUTE_GRAPH_UPSAMPLE_LAYER_NODE_H - -#include "arm_compute/graph/INode.h" - -namespace arm_compute -{ -namespace graph -{ -/** Upsample Layer node */ -class UpsampleLayerNode final : public INode -{ -public: - /** Constructor - * - * @param[in] info Stride info - * @param[in] upsampling_policy Upsampling policy - */ - UpsampleLayerNode(Size2D info, InterpolationPolicy upsampling_policy); - /** Stride info metadata accessor - * - * @return The stride info of the layer - */ - Size2D info() const; - /** Upsampling policy metadata accessor - * - * @return The upsampling policy of the layer - */ - InterpolationPolicy upsampling_policy() const; - /** Computes upsample output descriptor - * - * @param[in] input_descriptor Input descriptor - * @param[in] info Stride information - * - * @return Output descriptor - */ - static TensorDescriptor compute_output_descriptor(const TensorDescriptor &input_descriptor, Size2D info); - - // Inherited overridden methods: - NodeType type() const override; - bool forward_descriptors() override; - TensorDescriptor configure_output(size_t idx) const override; - void accept(INodeVisitor &v) override; - -private: - Size2D _info; - InterpolationPolicy _upsampling_policy; -}; -} // namespace graph -} // namespace arm_compute -#endif /* ARM_COMPUTE_GRAPH_UPSAMPLE_LAYER_NODE_H */ |