diff options
author | Georgios Pinitas <georgios.pinitas@arm.com> | 2018-04-03 13:44:29 +0100 |
---|---|---|
committer | Anthony Barbier <anthony.barbier@arm.com> | 2018-11-02 16:49:16 +0000 |
commit | d9eb27597eabe5b7c17520f4f9b3f8a282d72573 (patch) | |
tree | 9b2b7d74b0ef83623b18d6d4279a564e5b63d641 /arm_compute | |
parent | a8ca2b0cfe052c9a28b691317a674f28f495c139 (diff) | |
download | ComputeLibrary-d9eb27597eabe5b7c17520f4f9b3f8a282d72573.tar.gz |
COMPMID-797: Switch to new graph.
- Cleaned up build system
Change-Id: If2faa27ee5b31fa8b972836960ab3ef671059c8d
Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/126435
Tested-by: Jenkins <bsgcomp@arm.com>
Reviewed-by: Pablo Tello <pablo.tello@arm.com>
Diffstat (limited to 'arm_compute')
-rw-r--r-- | arm_compute/core/CL/OpenCL.h | 2 | ||||
-rw-r--r-- | arm_compute/core/Error.h | 2 | ||||
-rw-r--r-- | arm_compute/graph.h (renamed from arm_compute/graph/nodes/DequantizationLayer.h) | 56 | ||||
-rw-r--r-- | arm_compute/graph/CL/CLMap.h | 66 | ||||
-rw-r--r-- | arm_compute/graph/CL/CLUnmap.h | 63 | ||||
-rw-r--r-- | arm_compute/graph/Edge.h (renamed from arm_compute/graph2/Edge.h) | 16 | ||||
-rw-r--r-- | arm_compute/graph/Error.h | 64 | ||||
-rw-r--r-- | arm_compute/graph/Graph.h | 294 | ||||
-rw-r--r-- | arm_compute/graph/GraphBuilder.h (renamed from arm_compute/graph2/GraphBuilder.h) | 14 | ||||
-rw-r--r-- | arm_compute/graph/GraphContext.h | 90 | ||||
-rw-r--r-- | arm_compute/graph/GraphManager.h (renamed from arm_compute/graph2/GraphManager.h) | 14 | ||||
-rw-r--r-- | arm_compute/graph/IDeviceBackend.h (renamed from arm_compute/graph2/IDeviceBackend.h) | 19 | ||||
-rw-r--r-- | arm_compute/graph/IGraphMutator.h (renamed from arm_compute/graph2/IGraphMutator.h) | 10 | ||||
-rw-r--r-- | arm_compute/graph/IGraphPrinter.h (renamed from arm_compute/graph2/IGraphPrinter.h) | 10 | ||||
-rw-r--r-- | arm_compute/graph/INode.h | 227 | ||||
-rw-r--r-- | arm_compute/graph/INodeVisitor.h (renamed from arm_compute/graph2/INodeVisitor.h) | 12 | ||||
-rw-r--r-- | arm_compute/graph/IOperation.h | 72 | ||||
-rw-r--r-- | arm_compute/graph/ITensorAccessor.h | 14 | ||||
-rw-r--r-- | arm_compute/graph/ITensorHandle.h (renamed from arm_compute/graph2/ITensorHandle.h) | 10 | ||||
-rw-r--r-- | arm_compute/graph/ITensorObject.h | 80 | ||||
-rw-r--r-- | arm_compute/graph/Logger.h (renamed from arm_compute/graph2/Logger.h) | 6 | ||||
-rw-r--r-- | arm_compute/graph/NodeContext.h | 142 | ||||
-rw-r--r-- | arm_compute/graph/NodeParameter.h | 74 | ||||
-rw-r--r-- | arm_compute/graph/OperationRegistrar.h | 59 | ||||
-rw-r--r-- | arm_compute/graph/OperationRegistry.h | 86 | ||||
-rw-r--r-- | arm_compute/graph/PassManager.h (renamed from arm_compute/graph2/PassManager.h) | 12 | ||||
-rw-r--r-- | arm_compute/graph/SubGraph.h | 94 | ||||
-rw-r--r-- | arm_compute/graph/SubTensor.h | 96 | ||||
-rw-r--r-- | arm_compute/graph/Tensor.h | 124 | ||||
-rw-r--r-- | arm_compute/graph/TensorDescriptor.h (renamed from arm_compute/graph2/TensorDescriptor.h) | 12 | ||||
-rw-r--r-- | arm_compute/graph/TypePrinter.h (renamed from arm_compute/graph2/TypePrinter.h) | 12 | ||||
-rw-r--r-- | arm_compute/graph/Types.h | 166 | ||||
-rw-r--r-- | arm_compute/graph/Utils.h (renamed from arm_compute/graph2/Utils.h) | 14 | ||||
-rw-r--r-- | arm_compute/graph/Workload.h (renamed from arm_compute/graph2/Workload.h) | 10 | ||||
-rw-r--r-- | arm_compute/graph/algorithms/Algorithms.h (renamed from arm_compute/graph2/algorithms/Algorithms.h) | 8 | ||||
-rw-r--r-- | arm_compute/graph/algorithms/BFS.h (renamed from arm_compute/graph2/algorithms/BFS.h) | 12 | ||||
-rw-r--r-- | arm_compute/graph/backends/BackendRegistrar.h (renamed from arm_compute/graph2/backends/BackendRegistrar.h) | 14 | ||||
-rw-r--r-- | arm_compute/graph/backends/BackendRegistry.h (renamed from arm_compute/graph2/backends/BackendRegistry.h) | 14 | ||||
-rw-r--r-- | arm_compute/graph/backends/CL/CLDeviceBackend.h (renamed from arm_compute/graph2/backends/CL/CLDeviceBackend.h) | 13 | ||||
-rw-r--r-- | arm_compute/graph/backends/CL/CLFunctionFactory.h (renamed from arm_compute/graph2/backends/CL/CLFunctionFactory.h) | 10 | ||||
-rw-r--r-- | arm_compute/graph/backends/CL/CLNodeValidator.h (renamed from arm_compute/graph2/backends/CL/CLNodeValidator.h) | 10 | ||||
-rw-r--r-- | arm_compute/graph/backends/CL/CLSubTensorHandle.h (renamed from arm_compute/graph2/backends/CL/CLSubTensorHandle.h) | 12 | ||||
-rw-r--r-- | arm_compute/graph/backends/CL/CLTensorHandle.h (renamed from arm_compute/graph2/backends/CL/CLTensorHandle.h) | 12 | ||||
-rw-r--r-- | arm_compute/graph/backends/GLES/GCDeviceBackend.h (renamed from arm_compute/graph2/backends/GLES/GCDeviceBackend.h) | 13 | ||||
-rw-r--r-- | arm_compute/graph/backends/GLES/GCFunctionFactory.h (renamed from arm_compute/graph2/backends/GLES/GCFunctionFactory.h) | 10 | ||||
-rw-r--r-- | arm_compute/graph/backends/GLES/GCNodeValidator.h (renamed from arm_compute/graph2/backends/GLES/GCNodeValidator.h) | 10 | ||||
-rw-r--r-- | arm_compute/graph/backends/GLES/GCTensorHandle.h (renamed from arm_compute/graph2/backends/GLES/GCTensorHandle.h) | 12 | ||||
-rw-r--r-- | arm_compute/graph/backends/NEON/NEDeviceBackend.h (renamed from arm_compute/graph2/backends/NEON/NEDeviceBackend.h) | 13 | ||||
-rw-r--r-- | arm_compute/graph/backends/NEON/NEFunctionFactory.h (renamed from arm_compute/graph2/backends/NEON/NEFunctionFactory.h) | 10 | ||||
-rw-r--r-- | arm_compute/graph/backends/NEON/NENodeValidator.h (renamed from arm_compute/graph2/backends/NEON/NENodeValidator.h) | 10 | ||||
-rw-r--r-- | arm_compute/graph/backends/NEON/NESubTensorHandle.h (renamed from arm_compute/graph2/backends/NEON/NESubTensorHandle.h) | 12 | ||||
-rw-r--r-- | arm_compute/graph/backends/NEON/NETensorHandle.h (renamed from arm_compute/graph2/backends/NEON/NETensorHandle.h) | 12 | ||||
-rw-r--r-- | arm_compute/graph/backends/Utils.h (renamed from arm_compute/graph2/backends/Utils.h) | 12 | ||||
-rw-r--r-- | arm_compute/graph/backends/ValidateHelpers.h (renamed from arm_compute/graph2/backends/ValidateHelpers.h) | 21 | ||||
-rw-r--r-- | arm_compute/graph/detail/ExecutionHelpers.h (renamed from arm_compute/graph2/detail/ExecutionHelpers.h) | 12 | ||||
-rw-r--r-- | arm_compute/graph/frontend/ILayer.h (renamed from arm_compute/graph2/frontend/ILayer.h) | 10 | ||||
-rw-r--r-- | arm_compute/graph/frontend/IStream.h (renamed from arm_compute/graph2/frontend/IStream.h) | 12 | ||||
-rw-r--r-- | arm_compute/graph/frontend/IStreamOperators.h (renamed from arm_compute/graph2/frontend/IStreamOperators.h) | 14 | ||||
-rw-r--r-- | arm_compute/graph/frontend/Layers.h (renamed from arm_compute/graph2/frontend/Layers.h) | 20 | ||||
-rw-r--r-- | arm_compute/graph/frontend/Stream.h (renamed from arm_compute/graph2/frontend/Stream.h) | 22 | ||||
-rw-r--r-- | arm_compute/graph/frontend/SubStream.h (renamed from arm_compute/graph2/frontend/SubStream.h) | 16 | ||||
-rw-r--r-- | arm_compute/graph/frontend/Types.h (renamed from arm_compute/graph2/frontend/Types.h) | 40 | ||||
-rw-r--r-- | arm_compute/graph/mutators/DepthConcatSubTensorMutator.h (renamed from arm_compute/graph2/mutators/DepthConcatSubTensorMutator.h) | 12 | ||||
-rw-r--r-- | arm_compute/graph/mutators/GraphMutators.h (renamed from arm_compute/graph2/mutators/GraphMutators.h) | 14 | ||||
-rw-r--r-- | arm_compute/graph/mutators/InPlaceOperationMutator.h (renamed from arm_compute/graph2/mutators/InPlaceOperationMutator.h) | 12 | ||||
-rw-r--r-- | arm_compute/graph/mutators/NodeFusionMutator.h (renamed from arm_compute/graph2/mutators/NodeFusionMutator.h) | 12 | ||||
-rw-r--r-- | arm_compute/graph/mutators/SplitLayerSubTensorMutator.h (renamed from arm_compute/graph2/mutators/SplitLayerSubTensorMutator.h) | 12 | ||||
-rw-r--r-- | arm_compute/graph/nodes/ActivationLayer.h | 54 | ||||
-rw-r--r-- | arm_compute/graph/nodes/ActivationLayerNode.h (renamed from arm_compute/graph2/nodes/ActivationLayerNode.h) | 12 | ||||
-rw-r--r-- | arm_compute/graph/nodes/BatchNormalizationLayer.h | 70 | ||||
-rw-r--r-- | arm_compute/graph/nodes/BatchNormalizationLayerNode.h (renamed from arm_compute/graph2/nodes/BatchNormalizationLayerNode.h) | 12 | ||||
-rw-r--r-- | arm_compute/graph/nodes/BranchLayer.h | 88 | ||||
-rw-r--r-- | arm_compute/graph/nodes/ConstNode.h (renamed from arm_compute/graph2/nodes/ConstNode.h) | 12 | ||||
-rw-r--r-- | arm_compute/graph/nodes/ConvolutionLayer.h | 128 | ||||
-rw-r--r-- | arm_compute/graph/nodes/ConvolutionLayerNode.h (renamed from arm_compute/graph2/nodes/ConvolutionLayerNode.h) | 12 | ||||
-rw-r--r-- | arm_compute/graph/nodes/DepthConcatenateLayerNode.h (renamed from arm_compute/graph2/nodes/DepthConcatenateLayerNode.h) | 12 | ||||
-rw-r--r-- | arm_compute/graph/nodes/DepthConvertLayer.h | 58 | ||||
-rw-r--r-- | arm_compute/graph/nodes/DepthwiseConvolutionLayer.h | 76 | ||||
-rw-r--r-- | arm_compute/graph/nodes/DepthwiseConvolutionLayerNode.h (renamed from arm_compute/graph2/nodes/DepthwiseConvolutionLayerNode.h) | 12 | ||||
-rw-r--r-- | arm_compute/graph/nodes/EltwiseLayerNode.h (renamed from arm_compute/graph2/nodes/EltwiseLayerNode.h) | 12 | ||||
-rw-r--r-- | arm_compute/graph/nodes/FlattenLayer.h | 45 | ||||
-rw-r--r-- | arm_compute/graph/nodes/FlattenLayerNode.h (renamed from arm_compute/graph2/nodes/FlattenLayerNode.h) | 12 | ||||
-rw-r--r-- | arm_compute/graph/nodes/FloorLayer.h | 45 | ||||
-rw-r--r-- | arm_compute/graph/nodes/FullyConnectedLayer.h | 64 | ||||
-rw-r--r-- | arm_compute/graph/nodes/FullyConnectedLayerNode.h (renamed from arm_compute/graph2/nodes/FullyConnectedLayerNode.h) | 12 | ||||
-rw-r--r-- | arm_compute/graph/nodes/InputNode.h (renamed from arm_compute/graph2/nodes/InputNode.h) | 12 | ||||
-rw-r--r-- | arm_compute/graph/nodes/L2NormalizeLayer.h | 56 | ||||
-rw-r--r-- | arm_compute/graph/nodes/Nodes.h (renamed from arm_compute/graph/Nodes.h) | 35 | ||||
-rw-r--r-- | arm_compute/graph/nodes/NodesFwd.h (renamed from arm_compute/graph2/nodes/NodesFwd.h) | 10 | ||||
-rw-r--r-- | arm_compute/graph/nodes/NormalizationLayer.h | 54 | ||||
-rw-r--r-- | arm_compute/graph/nodes/NormalizationLayerNode.h (renamed from arm_compute/graph2/nodes/NormalizationLayerNode.h) | 12 | ||||
-rw-r--r-- | arm_compute/graph/nodes/OutputNode.h (renamed from arm_compute/graph2/nodes/OutputNode.h) | 12 | ||||
-rw-r--r-- | arm_compute/graph/nodes/PoolingLayer.h | 54 | ||||
-rw-r--r-- | arm_compute/graph/nodes/PoolingLayerNode.h (renamed from arm_compute/graph2/nodes/PoolingLayerNode.h) | 12 | ||||
-rw-r--r-- | arm_compute/graph/nodes/QuantizationLayer.h | 45 | ||||
-rw-r--r-- | arm_compute/graph/nodes/ReshapeLayer.h | 54 | ||||
-rw-r--r-- | arm_compute/graph/nodes/ReshapeLayerNode.h (renamed from arm_compute/graph2/nodes/ReshapeLayerNode.h) | 12 | ||||
-rw-r--r-- | arm_compute/graph/nodes/ResidualLayer.h | 76 | ||||
-rw-r--r-- | arm_compute/graph/nodes/SoftmaxLayer.h | 44 | ||||
-rw-r--r-- | arm_compute/graph/nodes/SoftmaxLayerNode.h (renamed from arm_compute/graph2/nodes/SoftmaxLayerNode.h) | 12 | ||||
-rw-r--r-- | arm_compute/graph/nodes/SplitLayerNode.h (renamed from arm_compute/graph2/nodes/SplitLayerNode.h) | 12 | ||||
-rw-r--r-- | arm_compute/graph/printers/DotGraphPrinter.h (renamed from arm_compute/graph2/printers/DotGraphPrinter.h) | 14 | ||||
-rw-r--r-- | arm_compute/graph/printers/Printers.h (renamed from arm_compute/graph2/printers/Printers.h) | 8 | ||||
-rw-r--r-- | arm_compute/graph2.h | 55 | ||||
-rw-r--r-- | arm_compute/graph2/Graph.h | 262 | ||||
-rw-r--r-- | arm_compute/graph2/GraphContext.h | 94 | ||||
-rw-r--r-- | arm_compute/graph2/INode.h | 252 | ||||
-rw-r--r-- | arm_compute/graph2/ITensorAccessor.h | 41 | ||||
-rw-r--r-- | arm_compute/graph2/Tensor.h | 114 | ||||
-rw-r--r-- | arm_compute/graph2/Types.h | 171 | ||||
-rw-r--r-- | arm_compute/graph2/nodes/Nodes.h | 44 |
111 files changed, 1092 insertions, 3701 deletions
diff --git a/arm_compute/core/CL/OpenCL.h b/arm_compute/core/CL/OpenCL.h index f83c73f371..44e886564a 100644 --- a/arm_compute/core/CL/OpenCL.h +++ b/arm_compute/core/CL/OpenCL.h @@ -119,6 +119,8 @@ public: DECLARE_FUNCTION_PTR(clSVMFree); DECLARE_FUNCTION_PTR(clEnqueueSVMMap); DECLARE_FUNCTION_PTR(clEnqueueSVMUnmap); + DECLARE_FUNCTION_PTR(clEnqueueMarker); + DECLARE_FUNCTION_PTR(clWaitForEvents); #undef DECLARE_FUNCTION_PTR diff --git a/arm_compute/core/Error.h b/arm_compute/core/Error.h index ce395ccfae..590da9b58e 100644 --- a/arm_compute/core/Error.h +++ b/arm_compute/core/Error.h @@ -156,7 +156,7 @@ Status create_error(ErrorCode error_code, const char *function, const char *file * * @param[in] ... Variables which are unused. */ -#define ARM_COMPUTE_UNUSED(...) ignore_unused(__VA_ARGS__) // NOLINT +#define ARM_COMPUTE_UNUSED(...) arm_compute::ignore_unused(__VA_ARGS__) // NOLINT /** Creates an error with a given message * diff --git a/arm_compute/graph/nodes/DequantizationLayer.h b/arm_compute/graph.h index f9b7e8af87..823a20f677 100644 --- a/arm_compute/graph/nodes/DequantizationLayer.h +++ b/arm_compute/graph.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 ARM Limited. + * Copyright (c) 2018 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -21,39 +21,35 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#ifndef __ARM_COMPUTE_GRAPH_DEQUANTIZATION_LAYER_H__ -#define __ARM_COMPUTE_GRAPH_DEQUANTIZATION_LAYER_H__ +#ifndef __ARM_COMPUTE_GRAPH_H__ +#define __ARM_COMPUTE_GRAPH_H__ -#include "arm_compute/graph/GraphContext.h" +// IR +#include "arm_compute/graph/Edge.h" +#include "arm_compute/graph/Graph.h" +#include "arm_compute/graph/GraphBuilder.h" +#include "arm_compute/graph/IDeviceBackend.h" +#include "arm_compute/graph/IGraphMutator.h" +#include "arm_compute/graph/IGraphPrinter.h" #include "arm_compute/graph/INode.h" -#include "arm_compute/graph/ITensorObject.h" +#include "arm_compute/graph/INodeVisitor.h" +#include "arm_compute/graph/Logger.h" #include "arm_compute/graph/Tensor.h" +#include "arm_compute/graph/TensorDescriptor.h" +#include "arm_compute/graph/TypePrinter.h" #include "arm_compute/graph/Types.h" -namespace arm_compute -{ -namespace graph -{ -/** DequantizationLayer layer node */ -class DequantizationLayer final : public INode -{ -public: - /** Default constructor - * - * @param[in] min_max Min max value tensor - */ - template <typename AccessorType> - DequantizationLayer(AccessorType &&min_max) - : _min_max(std::move(min_max)) - { - } +// Algorithms +#include "arm_compute/graph/algorithms/Algorithms.h" +#include "arm_compute/graph/mutators/GraphMutators.h" +#include "arm_compute/graph/nodes/Nodes.h" +#include "arm_compute/graph/printers/Printers.h" - // Inherited methods overriden: - std::unique_ptr<arm_compute::IFunction> instantiate_node(GraphContext &ctx, ITensorObject *input, ITensorObject *output) override; +// Frontend +#include "arm_compute/graph/frontend/IStreamOperators.h" +#include "arm_compute/graph/frontend/Layers.h" +#include "arm_compute/graph/frontend/Stream.h" +#include "arm_compute/graph/frontend/SubStream.h" +#include "arm_compute/graph/frontend/Types.h" -private: - Tensor _min_max; -}; -} // namespace graph -} // namespace arm_compute -#endif /* __ARM_COMPUTE_GRAPH_DEQUANTIZATION_LAYER_H__ */ +#endif /* __ARM_COMPUTE_GRAPH_H__ */ diff --git a/arm_compute/graph/CL/CLMap.h b/arm_compute/graph/CL/CLMap.h deleted file mode 100644 index 732a1df77f..0000000000 --- a/arm_compute/graph/CL/CLMap.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2017 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_CLMAP_H__ -#define __ARM_COMPUTE_GRAPH_CLMAP_H__ - -#include "arm_compute/graph/Types.h" -#include "arm_compute/runtime/IFunction.h" - -namespace arm_compute -{ -class ICLTensor; - -namespace graph -{ -class ITensorObject; -/** OpenCL map function */ -class CLMap : public arm_compute::IFunction -{ -public: - /** Constructor - * - * @param[in] tensor Tensor to map - * @param[in] blocking Flag to specify if the map should be blocking or not (defaults to false) - */ - CLMap(ITensorObject *tensor, bool blocking = false); - /** Prevent instances from being copy constructed */ - CLMap(const CLMap &) = delete; - /** Prevent instances from being copy assigned */ - const CLMap &operator=(const CLMap &) = delete; - /** Allow instances to be move constructed */ - CLMap(CLMap &&) = default; - /** Allow instances to be move assigned */ - CLMap &operator=(CLMap &&) = default; - - // Inherited methods overriden: - void run() override; - -private: - arm_compute::ICLTensor *_tensor; /**< Tensor */ - bool _blocking; /**< Blocking flag */ -}; -} // namespace graph -} // namespace arm_compute - -#endif /* __ARM_COMPUTE_GRAPH_CLMAP_H__ */ diff --git a/arm_compute/graph/CL/CLUnmap.h b/arm_compute/graph/CL/CLUnmap.h deleted file mode 100644 index 17745c436b..0000000000 --- a/arm_compute/graph/CL/CLUnmap.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) 2017 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_CLUNMAP_H__ -#define __ARM_COMPUTE_GRAPH_CLUNMAP_H__ - -#include "arm_compute/graph/Types.h" -#include "arm_compute/runtime/IFunction.h" - -namespace arm_compute -{ -class ICLTensor; - -namespace graph -{ -class ITensorObject; -/** OpenCL un-map function */ -class CLUnmap : public arm_compute::IFunction -{ -public: - /** Constructor - * - * @param[in] tensor Tensor to un-map - */ - CLUnmap(ITensorObject *tensor); - /** Prevent instances from being copy constructed */ - CLUnmap(const CLUnmap &) = delete; - /** Prevent instances from being copy assigned */ - const CLUnmap &operator=(const CLUnmap &) = delete; - /** Allow instances to be move constructed */ - CLUnmap(CLUnmap &&) = default; - /** Allow instances to be move assigned */ - CLUnmap &operator=(CLUnmap &&) = default; - - // Inherited methods overriden: - void run() override; - -private: - arm_compute::ICLTensor *_tensor; /**< Tensor */ -}; -} // namespace graph -} // namespace arm_compute -#endif /* __ARM_COMPUTE_GRAPH_CLUNMAP_H__ */ diff --git a/arm_compute/graph2/Edge.h b/arm_compute/graph/Edge.h index e82bcb295a..003b0dee94 100644 --- a/arm_compute/graph2/Edge.h +++ b/arm_compute/graph/Edge.h @@ -21,16 +21,16 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#ifndef __ARM_COMPUTE_GRAPH2_EDGE_H__ -#define __ARM_COMPUTE_GRAPH2_EDGE_H__ +#ifndef __ARM_COMPUTE_GRAPH_EDGE_H__ +#define __ARM_COMPUTE_GRAPH_EDGE_H__ -#include "arm_compute/graph2/INode.h" -#include "arm_compute/graph2/Tensor.h" -#include "arm_compute/graph2/Types.h" +#include "arm_compute/graph/INode.h" +#include "arm_compute/graph/Tensor.h" +#include "arm_compute/graph/Types.h" namespace arm_compute { -namespace graph2 +namespace graph { // Forward declarations class Graph; @@ -147,6 +147,6 @@ private: unsigned int _consumer_idx; Tensor *_tensor; }; -} // namespace graph2 +} // namespace graph } // namespace arm_compute -#endif /* __ARM_COMPUTE_GRAPH2_EDGE_H__ */ +#endif /* __ARM_COMPUTE_GRAPH_EDGE_H__ */ diff --git a/arm_compute/graph/Error.h b/arm_compute/graph/Error.h deleted file mode 100644 index 0c8ed266c0..0000000000 --- a/arm_compute/graph/Error.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2017 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_ERROR_H__ -#define __ARM_COMPUTE_GRAPH_ERROR_H__ - -#include "arm_compute/graph/ITensorObject.h" - -namespace arm_compute -{ -namespace graph -{ -/** Evaluate if a tensor object is null. If the condition is true then an error message is printed and an exception thrown - * - * @param[in] function Function in which the error occurred. - * @param[in] file Name of the file where the error occurred. - * @param[in] line Line on which the error occurred. - * @param[in] tensor_object Tensor object to evaluate - * @param[in] tensor_objects (Optional) Further allowed tensor objects. - */ -template <typename... Ts> -void error_on_unallocated_tensor_object(const char *function, const char *file, int line, - const ITensorObject *tensor_object, Ts... tensor_objects) -{ - ARM_COMPUTE_UNUSED(function); - ARM_COMPUTE_UNUSED(file); - ARM_COMPUTE_UNUSED(line); - ARM_COMPUTE_UNUSED(tensor_object); - - ARM_COMPUTE_ERROR_ON_LOC(tensor_object == nullptr || tensor_object->tensor() == nullptr, function, file, line); - - const std::array<const ITensorObject *, sizeof...(Ts)> tensor_objects_array{ { std::forward<Ts>(tensor_objects)... } }; - ARM_COMPUTE_UNUSED(tensor_objects_array); - - ARM_COMPUTE_ERROR_ON_LOC(std::any_of(tensor_objects_array.begin(), tensor_objects_array.end(), [&](const ITensorObject * tensor_obj) - { - return (tensor_obj == nullptr || tensor_object->tensor() == nullptr); - }), - function, file, line); -} -#define ARM_COMPUTE_ERROR_ON_UNALLOCATED_TENSOR_OBJECT(...) ::arm_compute::graph::error_on_unallocated_tensor_object(__func__, __FILE__, __LINE__, __VA_ARGS__) -} // namespace graph -} // namespace arm_compute -#endif /* __ARM_COMPUTE_GRAPH_ERROR_H__ */ diff --git a/arm_compute/graph/Graph.h b/arm_compute/graph/Graph.h index 72130878f8..16f5f97986 100644 --- a/arm_compute/graph/Graph.h +++ b/arm_compute/graph/Graph.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018 ARM Limited. + * Copyright (c) 2018 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -24,130 +24,238 @@ #ifndef __ARM_COMPUTE_GRAPH_GRAPH_H__ #define __ARM_COMPUTE_GRAPH_GRAPH_H__ -#include "arm_compute/core/CL/CLTypes.h" +#include "arm_compute/graph/Edge.h" #include "arm_compute/graph/INode.h" -#include "arm_compute/graph/ITensorObject.h" -#include "arm_compute/graph/SubTensor.h" #include "arm_compute/graph/Tensor.h" #include "arm_compute/graph/Types.h" + +#include "support/Mutex.h" #include "support/ToolchainSupport.h" +#include <map> #include <memory> +#include <string> +#include <thread> +#include <utility> +#include <vector> namespace arm_compute { -class IFunction; - namespace graph { -/** Graph class */ +/** Graph class + * + * Represents a multiple source - multiple sink directed graph + */ class Graph final { public: - /** Constructor */ - Graph(); - /** Destructor */ - ~Graph(); - /** Prevent instances from being copy constructed */ + Graph() = default; + /** Constructor + * + * @param[in] id Graph identification number. Can be used to differentiate between graphs. Default value 0 + * @param[in] name Graph name. Default value empty string + */ + Graph(GraphID id, std::string name); + /** Prevent instances of this class from being copied (As this class contains pointers) */ Graph(const Graph &) = delete; - /** Prevent instances from being copy assigned */ - const Graph &operator=(const Graph &) = delete; - /** Prevent instances from being move constructed */ - Graph(Graph &&) = delete; - /** Prevent instances from being move assigned */ - Graph &operator=(Graph &&) = delete; - /** Initialize the graph - * - * @param[in] use_cl_tuner Use the CLTuner if this value is true - */ - void graph_init(const bool use_cl_tuner = false); - /** Executes the graph */ - void run(); + /** Prevent instances of this class from being copy assigned (As this class contains pointers) */ + Graph &operator=(const Graph &) = delete; + /** Allow instances of this class to be moved */ + Graph(Graph &&) = default; + /** Allow instances of this class to be move assigned */ + Graph &operator=(Graph &&) = default; /** Adds a node to the graph * - * @param[in] node Node to add + * @note Models a single output node + * + * @tparam NT Node operation + * @tparam Ts Arguments to operation + * + * @param args Node arguments + * + * @return ID of the node + */ + template <typename NT, typename... Ts> + NodeID add_node(Ts &&... args); + /** Remove the node with the given ID + * + * @param[in] nid ID of the node to remove + * + * @return True if the removal took place else false + */ + bool remove_node(NodeID nid); + /** Adds a connection between two nodes + * + * @param[in] source ID of the source node + * @param[in] source_idx Output index of the source node + * @param[in] sink ID of the sink node + * @param[in] sink_idx Input index of the sink node + * + * @return ID of this connection + */ + EdgeID add_connection(NodeID source, size_t source_idx, NodeID sink, size_t sink_idx); + /** Removes an edge (connection) + * + * @param[in] eid Connection to remove + * + * @return True if the removal took place else false + */ + bool remove_connection(EdgeID eid); + /** Returns graph name + * + * @return Graph name + */ + std::string name() const; + /** Returns graph id + * + * @return Graph id */ - void add_node(std::unique_ptr<INode> node); - /** Adds a tensor to the graph + GraphID id() const; + /** Returns graph input nodes * - * @param[in] tensor Tensor to add + * @return vector containing the graph inputs */ - void add_tensor_object(std::unique_ptr<ITensorObject> tensor); - /** Check if the OpenCL target is available + const std::vector<NodeID> &inputs(); + /** Returns nodes of graph + * + * @warning Nodes can be nullptr if they have been removed during the mutation steps of the graph + * + * @return Nodes of graph */ - static bool opencl_is_available(); - /** Returns the GPU target + std::vector<std::unique_ptr<INode>> &nodes(); + /** Returns nodes of graph + * + * @warning Nodes can be nullptr if they have been removed during the mutation steps of the graph + * + * @return Nodes of graph */ - static GPUTarget gpu_target(); - /** Manually sets the output of the current node + const std::vector<std::unique_ptr<INode>> &nodes() const; + /** Returns edges of graph + * + * @warning Edges can be nullptr if they have been removed during the mutation steps of the graph * - * @param[in] tmp Output info to set + * @return Edges of graph */ - void set_temp(TensorInfo &&tmp); + const std::vector<std::unique_ptr<Edge>> &edges() const; + /** Returns tensors of graph + * + * @warning Tensor can be nullptr if they have been removed during the mutation steps of the graph + * + * @return Tensors of graph + */ + std::vector<std::unique_ptr<Tensor>> &tensors(); + /** Returns tensors of graph + * + * @warning Tensor can be nullptr if they have been removed during the mutation steps of the graph + * + * @return Tensors of graph + */ + const std::vector<std::unique_ptr<Tensor>> &tensors() const; + /** Get node object given its id + * + * @warning Can be nullptr if node was removed during the mutation steps of the graph + * + * @param[in] id Node ID + * + * @return The actual node object + */ + const INode *node(NodeID id) const; + /** Get node object given its id + * + * @warning Can be nullptr if node was removed during the mutation steps of the graph + * + * @param[in] id Node ID + * + * @return The actual node object + */ + INode *node(NodeID id); + /** Get edge object given its id + * + * @warning Can be nullptr if node was removed during the mutation steps of the graph + * + * @param[in] id Edge ID + * + * @return The actual edge object + */ + const Edge *edge(EdgeID id) const; + /** Get edge object given its id + * + * @warning Can be nullptr if node was removed during the mutation steps of the graph + * + * @param[in] id Edge ID + * + * @return The actual edge object + */ + Edge *edge(EdgeID id); + /** Get tensor object given its id + * + * @warning Can be nullptr if tensor was removed during the mutation steps of the graph + * + * @param[in] id Tensor ID + * + * @return The actual tensor object + */ + const Tensor *tensor(TensorID id) const; + /** Get tensor object given its id + * + * @warning Can be nullptr if tensor was removed during the mutation steps of the graph + * + * @param[in] id Tensor ID + * + * @return The actual tensor object + */ + Tensor *tensor(TensorID id); - /** Returns the graph hints that are currently used +private: + /** Creates a tensor object * - * @return Graph hints + * @param[in] desc Tensor descriptor + * + * @return Tensor ID */ - GraphHints &hints(); + TensorID create_tensor(TensorDescriptor desc = TensorDescriptor()); private: - class Private; - std::unique_ptr<Private> _pimpl; /**< Internal implementation class */ + GraphID _id = GraphID(0); /**< Graph id */ + std::string _name = {}; /**< Graph name */ + std::vector<std::unique_ptr<INode>> _nodes = {}; /**< Graph nodes */ + std::vector<std::unique_ptr<Edge>> _edges = {}; /**< Graph edges */ + std::vector<std::unique_ptr<Tensor>> _tensors = {}; /**< Graph tensors */ + std::map<NodeType, std::vector<NodeID>> _tagged_nodes = {}; /**< Graph nodes map with the node type as key */ + arm_compute::Mutex _mtx = {}; /**< Mutex used for graph construction */ }; -/** Overloaded stream operator to add a tensor through its tensor info to the graph - * - * @param[in, out] graph Graph to add the tensor - * @param[in] info Tensor information of the tensor to be added - * - * @return Updated graph - */ -Graph &operator<<(Graph &graph, TensorInfo &&info); -/** Overloaded stream operator to add a tensor to the graph - * - * @param[in, out] graph Graph to add the tensor - * @param[in] tensor Tensor to be added - * - * @return Updated graph - */ -Graph &operator<<(Graph &graph, Tensor &&tensor); -/** Overloaded stream operator to add a sub-tensor to the graph - * - * @param[in, out] graph Graph to add the tensor - * @param[in] sub_tensor Sub-tensor to be added - * - * @return Updated graph - */ -Graph &operator<<(Graph &graph, SubTensor &&sub_tensor); -/** Overloaded stream operator to provide a target hint to the graph - * - * @param[in, out] graph Graph to provide the hint to - * @param[in] target_hint Target hint to be considered - * - * @return Updated graph - */ -Graph &operator<<(Graph &graph, TargetHint target_hint); -/** Overloaded stream operator to provide a convolution method hint to the graph - * - * @param[in, out] graph Graph to provide the hint to - * @param[in] conv_method_hint Convolution method hint to be considered - * - * @return Updated graph - */ -Graph &operator<<(Graph &graph, ConvolutionMethodHint conv_method_hint); -/** Overloaded stream operator to add a node to the graph - * - * @param[in, out] graph Graph to add the tensor - * @param[in] node Node to be added - * - * @return Updated graph - */ -template <typename Node> -Graph &operator<<(Graph &graph, Node node) +template <typename NT, typename... Ts> +inline NodeID Graph::add_node(Ts &&... args) { - graph.add_node(arm_compute::support::cpp14::make_unique<Node>(std::move(node))); - return graph; + std::lock_guard<arm_compute::Mutex> lock(_mtx); + + // Create node + NodeID nid = _nodes.size(); + auto node = support::cpp14::make_unique<NT>(std::forward<Ts>(args)...); + node->set_graph(this); + node->set_id(nid); + + // Keep track of input nodes + if(node->type() == NodeType::Input) + { + _tagged_nodes[NodeType::Input].push_back(nid); + } + + // Associate a new tensor with each output + for(auto &output : node->_outputs) + { + output = create_tensor(); + } + + // Propagate node shape if possible + node->forward_descriptors(); + + // Add node to the graph nodes + _nodes.push_back(std::move(node)); + + return nid; } } // namespace graph } // namespace arm_compute diff --git a/arm_compute/graph2/GraphBuilder.h b/arm_compute/graph/GraphBuilder.h index f9fb251fc5..e01cfb1bc6 100644 --- a/arm_compute/graph2/GraphBuilder.h +++ b/arm_compute/graph/GraphBuilder.h @@ -21,15 +21,15 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#ifndef __ARM_COMPUTE_GRAPH2_GRAPH_BUILDER_H__ -#define __ARM_COMPUTE_GRAPH2_GRAPH_BUILDER_H__ +#ifndef __ARM_COMPUTE_GRAPH_GRAPH_BUILDER_H__ +#define __ARM_COMPUTE_GRAPH_GRAPH_BUILDER_H__ -#include "arm_compute/graph2/ITensorAccessor.h" -#include "arm_compute/graph2/Types.h" +#include "arm_compute/graph/ITensorAccessor.h" +#include "arm_compute/graph/Types.h" namespace arm_compute { -namespace graph2 +namespace graph { // Forward declaration class Graph; @@ -227,6 +227,6 @@ public: */ static NodeID add_split_node(Graph &g, NodeParams params, NodeIdxPair input, unsigned int num_splits, unsigned int axis = 0); }; -} // namespace graph2 +} // namespace graph } // namespace arm_compute -#endif /* __ARM_COMPUTE_GRAPH2_GRAPH_BUILDER_H__ */ +#endif /* __ARM_COMPUTE_GRAPH_GRAPH_BUILDER_H__ */ diff --git a/arm_compute/graph/GraphContext.h b/arm_compute/graph/GraphContext.h index 98bc8c02f8..2f9ab665ce 100644 --- a/arm_compute/graph/GraphContext.h +++ b/arm_compute/graph/GraphContext.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 ARM Limited. + * Copyright (c) 2018 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -21,68 +21,74 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#ifndef __ARM_COMPUTE_GRAPH_CONTEXT_H__ -#define __ARM_COMPUTE_GRAPH_CONTEXT_H__ +#ifndef __ARM_COMPUTE_GRAPH_GRAPH_CONTEXT_H__ +#define __ARM_COMPUTE_GRAPH_GRAPH_CONTEXT_H__ #include "arm_compute/graph/Types.h" +#include "arm_compute/runtime/IMemoryManager.h" + +#include <map> +#include <memory> + namespace arm_compute { namespace graph { -/** Hints that can be passed to the graph to expose parameterization */ -class GraphHints +/** Contains structs required for memory management */ +struct MemoryManagerContext +{ + Target target = { Target::UNSPECIFIED }; /**< Target */ + std::shared_ptr<arm_compute::IMemoryManager> mm = { nullptr }; /**< Memory manager */ +}; + +/** Graph context **/ +class GraphContext final { public: - /** Default Constructor */ - GraphHints(TargetHint target_hint = TargetHint::DONT_CARE, - ConvolutionMethodHint conv_method_hint = ConvolutionMethodHint::GEMM); - /** Sets target execution hint + /** Constructor */ + GraphContext(); + /** Prevent instances of this class from being copied (As this class contains pointers) */ + GraphContext(const GraphContext &) = delete; + /** Default move constructor */ + GraphContext(GraphContext &&) = default; + /** Prevent instances of this class from being copied (As this class contains pointers) */ + GraphContext &operator=(const GraphContext &) = delete; + /** Default move assignment operator */ + GraphContext &operator=(GraphContext &&) = default; + /** Graph configuration accessor * - * @param target_hint Target execution hint - */ - void set_target_hint(TargetHint target_hint); - /** Sets convolution method to use + * @note Every alteration has to be done before graph finalization * - * @param convolution_method Convolution method to use + * @return The graph configuration */ - void set_convolution_method_hint(ConvolutionMethodHint convolution_method); - /** Returns target execution hint + const GraphConfig &config() const; + /** Sets graph configuration * - * @return target execution hint + * @param[in] config Configuration to use */ - TargetHint target_hint() const; - /** Returns convolution method hint + void set_config(const GraphConfig &config); + /** Inserts a memory manager context * - * @return convolution method hint - */ - ConvolutionMethodHint convolution_method_hint() const; - -private: - TargetHint _target_hint; /**< Target execution hint */ - ConvolutionMethodHint _convolution_method_hint; /**< Convolution method hint */ -}; - -/** Graph context */ -class GraphContext -{ -public: - /** Default Constuctor */ - GraphContext(); - /** Returns graph hints + * @param[in] memory_ctx Memory manage context * - * @return Graph hints + * @return If the insertion succeeded else false */ - GraphHints &hints(); - /** Returns graph hints + bool insert_memory_management_ctx(MemoryManagerContext &&memory_ctx); + /** Gets a memory manager context for a given target + * + * @param[in] target To retrieve the management context * - * @return Graph hints + * @return Management context for the target if exists else nullptr */ - const GraphHints &hints() const; + MemoryManagerContext *memory_management_ctx(Target target); + /** Finalizes memory managers in graph context */ + void finalize(); private: - GraphHints _hints; /**< Graph hints */ + GraphConfig _config; /**< Graph configuration */ + std::map<Target, MemoryManagerContext> _memory_managers; /**< Memory managers for each target */ }; } // namespace graph } // namespace arm_compute -#endif /* __ARM_COMPUTE_GRAPH_CONTEXT_H__ */ +#endif /* __ARM_COMPUTE_GRAPH_GRAPH_CONTEXT_H__ */ diff --git a/arm_compute/graph2/GraphManager.h b/arm_compute/graph/GraphManager.h index 0d5835f6a4..9526a0b4cc 100644 --- a/arm_compute/graph2/GraphManager.h +++ b/arm_compute/graph/GraphManager.h @@ -21,17 +21,17 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#ifndef __ARM_COMPUTE_GRAPH2_GRAPH_MANAGER_H__ -#define __ARM_COMPUTE_GRAPH2_GRAPH_MANAGER_H__ +#ifndef __ARM_COMPUTE_GRAPH_GRAPH_MANAGER_H__ +#define __ARM_COMPUTE_GRAPH_GRAPH_MANAGER_H__ -#include "arm_compute/graph2/Types.h" -#include "arm_compute/graph2/Workload.h" +#include "arm_compute/graph/Types.h" +#include "arm_compute/graph/Workload.h" #include <map> namespace arm_compute { -namespace graph2 +namespace graph { // Forward declaration class Graph; @@ -81,6 +81,6 @@ public: private: std::map<GraphID, ExecutionWorkload> _workloads = {}; /**< Graph workloads */ }; -} // namespace graph2 +} // namespace graph } // namespace arm_compute -#endif /* __ARM_COMPUTE_GRAPH2_GRAPH_MANAGER_H__ */ +#endif /* __ARM_COMPUTE_GRAPH_GRAPH_MANAGER_H__ */ diff --git a/arm_compute/graph2/IDeviceBackend.h b/arm_compute/graph/IDeviceBackend.h index f0d6297b7b..fa6fbae1ea 100644 --- a/arm_compute/graph2/IDeviceBackend.h +++ b/arm_compute/graph/IDeviceBackend.h @@ -21,11 +21,11 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#ifndef __ARM_COMPUTE_GRAPH2_IDEVICEBACKEND_H__ -#define __ARM_COMPUTE_GRAPH2_IDEVICEBACKEND_H__ +#ifndef __ARM_COMPUTE_GRAPH_IDEVICEBACKEND_H__ +#define __ARM_COMPUTE_GRAPH_IDEVICEBACKEND_H__ -#include "arm_compute/graph2/ITensorHandle.h" -#include "arm_compute/graph2/Types.h" +#include "arm_compute/graph/ITensorHandle.h" +#include "arm_compute/graph/Types.h" #include "arm_compute/runtime/IFunction.h" #include "arm_compute/runtime/IMemoryManager.h" @@ -33,7 +33,7 @@ namespace arm_compute { -namespace graph2 +namespace graph { // Forward declarations class Graph; @@ -56,6 +56,11 @@ public: * @param[in] ctx Graph context */ virtual void setup_backend_context(GraphContext &ctx) = 0; + /** Checks if an instantiated backend is actually supported + * + * @return True if the backend is supported else false + */ + virtual bool is_backend_supported() = 0; /** Create a backend Tensor * * @param[in] tensor The tensor we want to create a backend tensor for @@ -99,6 +104,6 @@ public: virtual std::shared_ptr<arm_compute::IMemoryManager> create_memory_manager(MemoryManagerAffinity affinity) = 0; }; } // namespace backends -} // namespace graph2 +} // namespace graph } // namespace arm_compute -#endif //__ARM_COMPUTE_GRAPH2_IDEVICEBACKEND_H__ +#endif //__ARM_COMPUTE_GRAPH_IDEVICEBACKEND_H__ diff --git a/arm_compute/graph2/IGraphMutator.h b/arm_compute/graph/IGraphMutator.h index 50151c87ce..714fd7c3d0 100644 --- a/arm_compute/graph2/IGraphMutator.h +++ b/arm_compute/graph/IGraphMutator.h @@ -21,12 +21,12 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#ifndef __ARM_COMPUTE_GRAPH2_IGRAPHMUTATOR_H__ -#define __ARM_COMPUTE_GRAPH2_IGRAPHMUTATOR_H__ +#ifndef __ARM_COMPUTE_GRAPH_IGRAPHMUTATOR_H__ +#define __ARM_COMPUTE_GRAPH_IGRAPHMUTATOR_H__ namespace arm_compute { -namespace graph2 +namespace graph { // Forward declarations class Graph; @@ -48,6 +48,6 @@ public: */ virtual const char *name() = 0; }; -} // namespace graph2 +} // namespace graph } // namespace arm_compute -#endif /* __ARM_COMPUTE_GRAPH2_IGRAPHMUTATOR_H__ */ +#endif /* __ARM_COMPUTE_GRAPH_IGRAPHMUTATOR_H__ */ diff --git a/arm_compute/graph2/IGraphPrinter.h b/arm_compute/graph/IGraphPrinter.h index eb85f97a5b..aba52b1f74 100644 --- a/arm_compute/graph2/IGraphPrinter.h +++ b/arm_compute/graph/IGraphPrinter.h @@ -21,14 +21,14 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#ifndef __ARM_COMPUTE_GRAPH2_IGRAPHPRINTER_H__ -#define __ARM_COMPUTE_GRAPH2_IGRAPHPRINTER_H__ +#ifndef __ARM_COMPUTE_GRAPH_IGRAPHPRINTER_H__ +#define __ARM_COMPUTE_GRAPH_IGRAPHPRINTER_H__ #include <ostream> namespace arm_compute { -namespace graph2 +namespace graph { // Forward declarations class Graph; @@ -46,6 +46,6 @@ public: */ virtual void print(const Graph &g, std::ostream &os) = 0; }; -} // namespace graph2 +} // namespace graph } // namespace arm_compute -#endif /* __ARM_COMPUTE_GRAPH2_IGRAPHPRINTER_H__ */ +#endif /* __ARM_COMPUTE_GRAPH_IGRAPHPRINTER_H__ */ diff --git a/arm_compute/graph/INode.h b/arm_compute/graph/INode.h index be4575de91..5d9c36e098 100644 --- a/arm_compute/graph/INode.h +++ b/arm_compute/graph/INode.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018 ARM Limited. + * Copyright (c) 2018 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -24,65 +24,228 @@ #ifndef __ARM_COMPUTE_GRAPH_INODE_H__ #define __ARM_COMPUTE_GRAPH_INODE_H__ -#include "arm_compute/graph/GraphContext.h" -#include "arm_compute/graph/ITensorObject.h" +#include "arm_compute/core/Error.h" +#include "arm_compute/graph/TensorDescriptor.h" #include "arm_compute/graph/Types.h" -#include "arm_compute/runtime/IFunction.h" -#include <memory> +#include <set> namespace arm_compute { namespace graph { +// Forward declarations +class Graph; +class Edge; +class INodeVisitor; +class Tensor; + /** Node interface */ class INode { public: - /** Virtual Destructor */ + /** Constructor */ + INode(); + /** Destructor **/ virtual ~INode() = default; - /** Interface to be implemented that instantiates the node + /** Prevent instances of this class from being copied (As this class contains pointers) */ + INode(const INode &) = delete; + /** Prevent instances of this class from being copy assigned (As this class contains pointers) */ + INode &operator=(const INode &) = delete; + /** Allow instances of this class to be moved */ + INode(INode &&) = default; + /** Allow instances of this class to be move assigned */ + INode &operator=(INode &&) = default; + /** Validate node * - * @param[in] ctx Graph context to be used - * @param[in] input Input tensor of the node - * @param[in] output Output tensor of the node + * @return Status containing any errors + */ + virtual Status validate() = 0; + /** Returns node's type * - * @return a pointer to the function which implements the node. + * @return Node's type */ - virtual std::unique_ptr<arm_compute::IFunction> instantiate_node(GraphContext &ctx, ITensorObject *input, ITensorObject *output) = 0; - /** Override the existing target hint + virtual NodeType type() const = 0; + /** Accepts a node visitor * - * @note If the input is DONT_CARE then the method has to pick a technology, - * else it can accept the hint or override it (But not with DONT_CARE) + * @param[in] v Visitor to accept + */ + virtual void accept(INodeVisitor &v) = 0; + /** Forwards descriptor information to outputs if possible + * + * @return True if descriptor information could be forwarded otherwise false + */ + virtual bool forward_descriptors() = 0; + /** Calculates output configuration * - * @param[in] target_hint Target hint to be considered + * @param[in] idx Output index to configure * - * @return The updated target hint + * @return Output descriptor configuration */ - TargetHint override_target_hint(TargetHint target_hint) const; - /** Method to check if the node supports in-place operations. + virtual TensorDescriptor configure_output(size_t idx) const = 0; + /** Returns node's name * - * @return True if the node supports in-place operations, false otherwise. + * @return Node name */ - virtual bool supports_in_place() const; - /** Set the value of the _supports_in_place attribute. + std::string name() const; + /** Returns node's ID * - * @param[in] value Boolean value to assign to _supports_in_place. + * @return Node's ID */ - void set_supports_in_place(bool value); - -protected: - /** Interface to be implement that override the hints + NodeID id() const; + /** Returns node's Graph + * + * @return Node's graph + */ + const Graph *graph() const; + /** Returns node's Graph + * + * @return Node's graph + */ + Graph *graph(); + /** Sets the graph that this node is registered to + * + * @param[in] g Back reference to graph + */ + void set_graph(Graph *g); + /** Sets the node id + * + * @param[in] id Node id + */ + void set_id(NodeID id); + /** Sets common node parameters + * + * @param[in] common_params Common node parameters to set + */ + void set_common_node_parameters(NodeParams common_params); + /** Sets target preference * - * @param[in] hints Hints to be considered + * @note This is not the target that the graph executor might choose, its just an indication * - * @return The updated hints + * @param[in] target Target preference */ - virtual GraphHints node_override_hints(GraphHints hints) const; + void set_requested_target(Target target); + /** Sets the final execution target + * + * @note GraphManager might change this target + * + * @param[in] target Final execution target + */ + void set_assigned_target(Target target); + /** Sets the output tensor of at a given index + * + * @note All edges will get updated + * + * @param[in] tid Tensor ID + * @param[in] idx Output index + */ + void set_output_tensor(TensorID tid, size_t idx); + /** Returns inputs of the node + * + * @return Inputs of the node + */ + const std::vector<TensorID> &inputs() const; + /** Returns outputs of the node + * + * @return Outputs of the node + */ + const std::vector<TensorID> &outputs() const; + /** Returns input edge set + * + * @return Set of input edges + */ + const std::vector<EdgeID> &input_edges() const; + /** Returns output edge set + * + * @return Set of output edges + */ + const std::set<EdgeID> &output_edges() const; + /** Returns the tensor ID of a given input of the node + * + * @note Precondition : idx should be a valid input index + * + * @param[in] idx Index of the node input + * + * @return TensorID of the requested input + */ + TensorID input_id(size_t idx) const; + /** Returns the tensor ID of a given output of the node + * + * @note Precondition : idx should be a valid output index + * + * @param[in] idx Index of the node output + * + * @return TensorID of the requested output + */ + TensorID output_id(size_t idx) const; + /** Returns the tensor of a given input of the node + * + * @note Precondition : idx should be a valid input index + * + * @param[in] idx Index of the node input + * + * @return Tensor of the requested input + */ + Tensor *input(size_t idx) const; + /** Returns the tensor of a given output of the node + * + * @note Precondition : idx should be a valid output index + * + * @param[in] idx Index of the node output + * + * @return Tensor of the requested output + */ + Tensor *output(size_t idx) const; + /** Returns the edge ID of a given input of the node + * + * @note Precondition : idx should be a valid input index + * + * @param[in] idx Index of the node input + * + * @return EdgeID of the requested input + */ + EdgeID input_edge_id(size_t idx) const; + /** Returns the edge of a given input of the node + * + * @note Precondition : idx should be a valid input index + * + * @param[in] idx Index of the node input + * + * @return Edge of the requested input + */ + Edge *input_edge(size_t idx) const; + /** Returns number of inputs of the node + * + * @return Number of inputs + */ + size_t num_inputs() const; + /** Returns number of outputs of the node + * + * @return Number of outputs + */ + size_t num_outputs() const; + /** Returns requested target for this node + * + * @return Requested execution target + */ + Target requested_target() const; + /** Returns assigned target for this node + * + * @return Assigned target of this node + */ + Target assigned_target() const; + +protected: + friend class Graph; protected: - TargetHint _target_hint{ TargetHint::DONT_CARE }; - bool _supports_in_place{ false }; + Graph *_graph; /**< Backward reference to graph owning the node */ + NodeID _id; /**< Node ID */ + NodeParams _common_params; /**< Node common params */ + std::vector<TensorID> _outputs; /**< Output of the node */ + std::vector<EdgeID> _input_edges; /**< Inputs edge set */ + std::set<EdgeID> _output_edges; /**< Output edge set */ + Target _assigned_target; /**< Assigned target by the Graph executor */ }; } // namespace graph } // namespace arm_compute diff --git a/arm_compute/graph2/INodeVisitor.h b/arm_compute/graph/INodeVisitor.h index 024d83c835..b5446c4a55 100644 --- a/arm_compute/graph2/INodeVisitor.h +++ b/arm_compute/graph/INodeVisitor.h @@ -21,14 +21,14 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#ifndef __ARM_COMPUTE_GRAPH2_INODEVISITOR_H__ -#define __ARM_COMPUTE_GRAPH2_INODEVISITOR_H__ +#ifndef __ARM_COMPUTE_GRAPH_INODEVISITOR_H__ +#define __ARM_COMPUTE_GRAPH_INODEVISITOR_H__ -#include "arm_compute/graph2/nodes/NodesFwd.h" +#include "arm_compute/graph/nodes/NodesFwd.h" namespace arm_compute { -namespace graph2 +namespace graph { /** Node visitor interface */ class INodeVisitor @@ -211,6 +211,6 @@ public: */ virtual void default_visit() = 0; }; -} // namespace graph2 +} // namespace graph } // namespace arm_compute -#endif /* __ARM_COMPUTE_GRAPH2_INODEVISITOR_H__ */ +#endif /* __ARM_COMPUTE_GRAPH_INODEVISITOR_H__ */ diff --git a/arm_compute/graph/IOperation.h b/arm_compute/graph/IOperation.h deleted file mode 100644 index b1afb21db7..0000000000 --- a/arm_compute/graph/IOperation.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 2017-2018 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_IOPERATION_H__ -#define __ARM_COMPUTE_GRAPH_IOPERATION_H__ - -#include "arm_compute/graph/NodeContext.h" -#include "arm_compute/graph/Types.h" -#include "arm_compute/runtime/IFunction.h" - -#include <memory> - -namespace arm_compute -{ -namespace graph -{ -/** Operation functor interface */ -class IOperation -{ -public: - /** Virtual Destructor */ - virtual ~IOperation() = default; - /** Interface to be implemented that configures an operation - * - * @param[in] ctx Node parameters to be used by the operation - * - * @return a pointer to the function which implements the operation. - */ - virtual std::unique_ptr<arm_compute::IFunction> configure(NodeContext &ctx) = 0; - /** Interface to be implemented that returns the target of the operation - * - * @return Target of the operation - */ - virtual TargetHint target() const = 0; -}; - -#define REGISTER_SIMPLE_OPERATION(NAME, TARGET, OP) \ - class NAME : public IOperation \ - { \ - public: \ - std::unique_ptr<arm_compute::IFunction> configure(NodeContext &ctx) final; \ - TargetHint target() const final \ - { \ - return TargetHint::TARGET; \ - } \ - }; \ - static detail::OperationRegistrar<NAME> NAME##_registrar(OP); \ - std::unique_ptr<arm_compute::IFunction> NAME::configure(NodeContext &ctx) - -} // namespace graph -} // namespace arm_compute -#endif /* __ARM_COMPUTE_GRAPH_IOPERATION_H__ */ diff --git a/arm_compute/graph/ITensorAccessor.h b/arm_compute/graph/ITensorAccessor.h index d6a254ab73..2df39c29e1 100644 --- a/arm_compute/graph/ITensorAccessor.h +++ b/arm_compute/graph/ITensorAccessor.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 ARM Limited. + * Copyright (c) 2018 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -21,10 +21,12 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#ifndef __ARM_COMPUTE_GRAPH_ITENSORACCESSOR_H__ -#define __ARM_COMPUTE_GRAPH_ITENSORACCESSOR_H__ +#ifndef __ARM_COMPUTE_GRAPH_ITENSOR_ACCESSOR_H__ +#define __ARM_COMPUTE_GRAPH_ITENSOR_ACCESSOR_H__ -#include "arm_compute/graph/Types.h" +#include "arm_compute/core/ITensor.h" + +#include <memory> namespace arm_compute { @@ -44,6 +46,8 @@ public: */ virtual bool access_tensor(ITensor &tensor) = 0; }; + +using ITensorAccessorUPtr = std::unique_ptr<ITensorAccessor>; } // namespace graph } // namespace arm_compute -#endif /* __ARM_COMPUTE_GRAPH_ITENSORACCESSOR_H__ */ +#endif /* __ARM_COMPUTE_GRAPH_SUB_STREAM_H__ */
\ No newline at end of file diff --git a/arm_compute/graph2/ITensorHandle.h b/arm_compute/graph/ITensorHandle.h index c92a213121..cc7132e316 100644 --- a/arm_compute/graph2/ITensorHandle.h +++ b/arm_compute/graph/ITensorHandle.h @@ -21,14 +21,14 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#ifndef __ARM_COMPUTE_GRAPH2_ITENSORHANDLE_H__ -#define __ARM_COMPUTE_GRAPH2_ITENSORHANDLE_H__ +#ifndef __ARM_COMPUTE_GRAPH_ITENSORHANDLE_H__ +#define __ARM_COMPUTE_GRAPH_ITENSORHANDLE_H__ #include "arm_compute/core/ITensor.h" namespace arm_compute { -namespace graph2 +namespace graph { /** Tensor handle interface object */ class ITensorHandle @@ -64,6 +64,6 @@ public: */ virtual bool is_subtensor() const = 0; }; -} // namespace graph2 +} // namespace graph } // namespace arm_compute -#endif /* __ARM_COMPUTE_GRAPH2_ITENSORHANDLE_H__ */ +#endif /* __ARM_COMPUTE_GRAPH_ITENSORHANDLE_H__ */ diff --git a/arm_compute/graph/ITensorObject.h b/arm_compute/graph/ITensorObject.h deleted file mode 100644 index 1b6f929305..0000000000 --- a/arm_compute/graph/ITensorObject.h +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2017-2018 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_ITENSOROBJECT_H__ -#define __ARM_COMPUTE_GRAPH_ITENSOROBJECT_H__ - -#include "arm_compute/graph/ITensorAccessor.h" -#include "arm_compute/graph/Types.h" -#include "support/ToolchainSupport.h" - -#include <memory> - -namespace arm_compute -{ -namespace graph -{ -/** Tensor object interface */ -class ITensorObject -{ -public: - /** Default Destructor */ - virtual ~ITensorObject() = default; - /** Calls accessor on tensor - * - * @return True if succeeds else false - */ - virtual bool call_accessor() = 0; - /** Checks if tensor has an accessor set. - * - * @return True if an accessor has been set else false - */ - virtual bool has_accessor() const = 0; - /** Sets target of the tensor - * - * @param[in] target Target where the tensor should be pinned in - * - * @return Backend tensor - */ - virtual ITensor *set_target(TargetHint target) = 0; - /** Returns a pointer to the internal tensor - * - * @return Tensor - */ - virtual ITensor *tensor() = 0; - /** Returns a pointer to the internal tensor - * - * @return const Tensor - */ - virtual const ITensor *tensor() const = 0; - /** Return the target that this tensor is pinned on - * - * @return Target of the tensor - */ - virtual TargetHint target() const = 0; - /** Allocates the tensor */ - virtual void allocate() = 0; -}; -} // namespace graph -} // namespace arm_compute -#endif /* __ARM_COMPUTE_GRAPH_ITENSOROBJECT_H__ */ diff --git a/arm_compute/graph2/Logger.h b/arm_compute/graph/Logger.h index f3c263cd3f..8b87f47b3d 100644 --- a/arm_compute/graph2/Logger.h +++ b/arm_compute/graph/Logger.h @@ -21,8 +21,8 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#ifndef __ARM_COMPUTE_GRAPH2_LOGGER_H__ -#define __ARM_COMPUTE_GRAPH2_LOGGER_H__ +#ifndef __ARM_COMPUTE_GRAPH_LOGGER_H__ +#define __ARM_COMPUTE_GRAPH_LOGGER_H__ #include "arm_compute/core/utils/logging/Macros.h" @@ -59,4 +59,4 @@ ARM_COMPUTE_CREATE_DEFAULT_GRAPH_LOGGER(); \ ARM_COMPUTE_LOG_STREAM("GRAPH", arm_compute::logging::LogLevel::ERROR, x) -#endif /* __ARM_COMPUTE_GRAPH2_LOGGER_H__ */ +#endif /* __ARM_COMPUTE_GRAPH_LOGGER_H__ */ diff --git a/arm_compute/graph/NodeContext.h b/arm_compute/graph/NodeContext.h deleted file mode 100644 index 17ae49740b..0000000000 --- a/arm_compute/graph/NodeContext.h +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Copyright (c) 2017-2018 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_NODE_CONTEXT_H__ -#define __ARM_COMPUTE_GRAPH_NODE_CONTEXT_H__ - -#include "arm_compute/core/Error.h" -#include "arm_compute/graph/NodeParameter.h" -#include "arm_compute/graph/Types.h" -#include "support/ToolchainSupport.h" - -#include <map> -#include <memory> -#include <string> - -namespace arm_compute -{ -namespace graph -{ -/** Node Context class - * - * Node context class is used to hold all the parameters required by a node to execute - */ -class NodeContext -{ -public: - /** Default Constructor - * - * @param[in] operation Name of the operation - */ - NodeContext(OperationType operation) - : _operation(operation), _target(TargetHint::DONT_CARE), _inputs(), _outputs(), _parameters() {}; - /** Sets the execution target of the node - * - * @param[in] target Execution target of the node - */ - void set_target(TargetHint target); - /** Adds an input tensor to the context - * - * @param[in] input Input to add - */ - void add_input(arm_compute::ITensor *input); - /** Adds an output to the context - * - * @param[in] output Output to add - */ - void add_output(arm_compute::ITensor *output); - /** Adds a parameter to the context - * - * @param[in] name Parameter name - * @param[in] parameter Parameter to add - */ - template <typename T> - void add_parameter(std::string name, T parameter); - /** Returns the operation of this node. - * - * @return The operation type - */ - OperationType operation() const; - /** Returns the execution target of this node - * - * @return The execution target - */ - TargetHint target() const; - /** Returns input tensor of a given index - * - * @param[in] idx Index of the input tensor - * - * @return A pointer the requested input tensor else nullptr - */ - arm_compute::ITensor *input(size_t idx) const; - /** Returns output tensor of a given index - * - * @param[in] idx Index of the output tensor - * - * @return A pointer the requested output tensor else nullptr - */ - arm_compute::ITensor *output(size_t idx) const; - /** Returns the parameter with the given name - * - * @param[in] name Parameter name - * - * @return The requested parameter else an empty object - */ - template <typename T> - T parameter(std::string name) const; - /** Returns number of inputs - * - * @return Number of inputs - */ - size_t num_inputs() const; - /** Returns number of output - * - * @return Number of outputs - */ - size_t num_outputs() const; - -private: - OperationType _operation; - TargetHint _target; - std::vector<arm_compute::ITensor *> _inputs; - std::vector<arm_compute::ITensor *> _outputs; - std::map<std::string, std::unique_ptr<NodeParameterBase>> _parameters; -}; - -template <typename T> -inline void NodeContext::add_parameter(std::string name, T parameter) -{ - ARM_COMPUTE_ERROR_ON_MSG(_parameters.find(name) != _parameters.end(), "Parameter already exists!"); - _parameters[name] = support::cpp14::make_unique<NodeParameter<T>>(name, parameter); -} - -template <typename T> -inline T NodeContext::parameter(std::string name) const -{ - auto it = _parameters.find(name); - ARM_COMPUTE_ERROR_ON(it == _parameters.end()); - return static_cast<NodeParameter<T> *>(it->second.get())->value(); -} -} // namespace graph -} // namespace arm_compute -#endif /* __ARM_COMPUTE_GRAPH_NODE_CONTEXT_H__ */ diff --git a/arm_compute/graph/NodeParameter.h b/arm_compute/graph/NodeParameter.h deleted file mode 100644 index 9d3823d543..0000000000 --- a/arm_compute/graph/NodeParameter.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (c) 2017 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_NODE_PARAMETER_H__ -#define __ARM_COMPUTE_GRAPH_NODE_PARAMETER_H__ - -#include <ostream> -#include <string> - -namespace arm_compute -{ -namespace graph -{ -/**Node Parameter Empty base class */ -class NodeParameterBase -{ -}; - -/** Template parameter implementation */ -template <typename T> -class NodeParameter : public NodeParameterBase -{ -public: - /** Default Constructor - * - * @param[in] name Paremeter name - * @param[in] val Parameter value - */ - NodeParameter(std::string name, T val) - : _name(name), _val(val) {}; - /** Returns parameter's name - * - * @return the name of the parameter - */ - std::string name() const - { - return _name; - } - /** Returns parameter's value - * - * @return the value of the parameter - */ - T value() - { - return _val; - } - -private: - std::string _name; - T _val; -}; -} // namespace graph -} // namespace arm_compute -#endif /* __ARM_COMPUTE_GRAPH_NODE_PARAMETER_H__ */ diff --git a/arm_compute/graph/OperationRegistrar.h b/arm_compute/graph/OperationRegistrar.h deleted file mode 100644 index ee171c3510..0000000000 --- a/arm_compute/graph/OperationRegistrar.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2017 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_OPERATION_REGISTRAR -#define ARM_COMPUTE_GRAPH_OPERATION_REGISTRAR - -#include "arm_compute/graph/OperationRegistry.h" -#include "arm_compute/graph/Types.h" - -#include <string> -#include <utility> - -namespace arm_compute -{ -namespace graph -{ -namespace detail -{ -/** Helper class to statically register an operation */ -template <typename T> -class OperationRegistrar final -{ -public: - /** Add a new test case with the given name to the framework. - * - * @param[in] operation Operation type - */ - OperationRegistrar(OperationType operation); -}; - -template <typename T> -inline OperationRegistrar<T>::OperationRegistrar(OperationType operation) -{ - OperationRegistry::get().add_operation<T>(std::move(operation)); -} -} // namespace detail -} // namespace graph -} // namespace arm_compute -#endif /* ARM_COMPUTE_GRAPH_OPERATION_REGISTRAR */
\ No newline at end of file diff --git a/arm_compute/graph/OperationRegistry.h b/arm_compute/graph/OperationRegistry.h deleted file mode 100644 index ae68bf45a2..0000000000 --- a/arm_compute/graph/OperationRegistry.h +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (c) 2017 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_OPERATION_REGISTRY_H__ -#define __ARM_COMPUTE_GRAPH_OPERATION_REGISTRY_H__ - -#include "arm_compute/graph/IOperation.h" -#include "arm_compute/graph/Types.h" -#include "support/ToolchainSupport.h" - -#include <map> -#include <memory> -#include <string> - -namespace arm_compute -{ -namespace graph -{ -/** Registry holding all the supported operations */ -class OperationRegistry -{ -public: - /** Gets operation registry instance - * - * @return Operation registry instance - */ - static OperationRegistry &get(); - /** Finds an operation in the registry - * - * @param[in] operation Type of the operation to find - * @param[in] target Target of the operation - * - * @return Pointer to the operation functor if found, else nullptr - */ - IOperation *find_operation(OperationType operation, TargetHint target); - /** Checks if an operation for a given target exists - * - * @param[in] operation Operation type - * @param[in] target Execution target - * - * @return True if exists else false - */ - bool contains(OperationType operation, TargetHint target) const; - /** Registers an operation to the registry - * - * @param operation Operation to register - */ - template <typename T> - void add_operation(OperationType operation); - -private: - /** Default Constructor */ - OperationRegistry(); - -private: - std::map<OperationType, std::vector<std::unique_ptr<IOperation>>> _registered_ops; -}; - -template <typename T> -inline void OperationRegistry::add_operation(OperationType operation) -{ - _registered_ops[operation].emplace_back(support::cpp14::make_unique<T>()); -} -} // namespace graph -} // namespace arm_compute -#endif /* __ARM_COMPUTE_GRAPH_OPERATION_REGISTRY_H__ */ diff --git a/arm_compute/graph2/PassManager.h b/arm_compute/graph/PassManager.h index b1db18b4ad..9f32a458d0 100644 --- a/arm_compute/graph2/PassManager.h +++ b/arm_compute/graph/PassManager.h @@ -21,17 +21,17 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#ifndef __ARM_COMPUTE_GRAPH2_PASSMANAGER_H__ -#define __ARM_COMPUTE_GRAPH2_PASSMANAGER_H__ +#ifndef __ARM_COMPUTE_GRAPH_PASSMANAGER_H__ +#define __ARM_COMPUTE_GRAPH_PASSMANAGER_H__ -#include "arm_compute/graph2/IGraphMutator.h" +#include "arm_compute/graph/IGraphMutator.h" #include <memory> #include <vector> namespace arm_compute { -namespace graph2 +namespace graph { // Forward declarations class Graph; @@ -87,6 +87,6 @@ public: private: std::vector<std::unique_ptr<IGraphMutator>> _passes; /**< Vector of graph passes */ }; -} // namespace graph2 +} // namespace graph } // namespace arm_compute -#endif /* __ARM_COMPUTE_GRAPH2_PASSMANAGER_H__ */ +#endif /* __ARM_COMPUTE_GRAPH_PASSMANAGER_H__ */ diff --git a/arm_compute/graph/SubGraph.h b/arm_compute/graph/SubGraph.h deleted file mode 100644 index e3217e7095..0000000000 --- a/arm_compute/graph/SubGraph.h +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (c) 2017 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_SUBGRAPH_H__ -#define __ARM_COMPUTE_GRAPH_SUBGRAPH_H__ - -#include "arm_compute/graph/Graph.h" -#include "arm_compute/graph/INode.h" -#include "arm_compute/graph/ITensorObject.h" -#include "arm_compute/graph/SubTensor.h" -#include "arm_compute/graph/Tensor.h" -#include "arm_compute/graph/Types.h" -#include "arm_compute/runtime/IFunction.h" - -#include <memory> - -namespace arm_compute -{ -namespace graph -{ -/** SubGraph class */ -class SubGraph -{ -public: - /** Constructor */ - SubGraph(); - /** Adds a node to the graph - * - * @param[in] node Node to add - */ - void add_node(std::unique_ptr<INode> node); - /** Adds a tensor to the graph - * - * @param[in] tensor Tensor to add - */ - void add_tensor_object(std::unique_ptr<ITensorObject> tensor); - /** Constructs a graph from a subgraph - * - * @param[in] ctx Parent graph context - * @param[in] input Input to the graph - * @param[in] output Output to the graph - * - * @return A graph - */ - std::unique_ptr<Graph> construct(const GraphContext &ctx, std::unique_ptr<ITensorObject> input, std::unique_ptr<ITensorObject> output); - /** Checks if the subgraph has an input - * - * @return True if the sub-graph has an input else false - */ - bool has_input() const; - /** Checks if the subgraph has an output - * - * @return True if the sub-graph has an output else false - */ - bool has_output() const; - -private: - std::vector<std::unique_ptr<INode>> _nodes; - std::unique_ptr<ITensorObject> _input; - std::unique_ptr<ITensorObject> _output; -}; - -SubGraph &operator<<(SubGraph &graph, Tensor &&tensor); -SubGraph &operator<<(SubGraph &graph, SubTensor &&sub_tensor); - -template <typename Node> -SubGraph &operator<<(SubGraph &sub_graph, Node node) -{ - sub_graph.add_node(arm_compute::support::cpp14::make_unique<Node>(std::move(node))); - return sub_graph; -} -} // namespace graph -} // namespace arm_compute -#endif /* __ARM_COMPUTE_GRAPH_INODE_H__ */ diff --git a/arm_compute/graph/SubTensor.h b/arm_compute/graph/SubTensor.h deleted file mode 100644 index 43b835d49c..0000000000 --- a/arm_compute/graph/SubTensor.h +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright (c) 2017-2018 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_SUBTENSOR_H__ -#define __ARM_COMPUTE_GRAPH_SUBTENSOR_H__ - -#include "arm_compute/graph/ITensorAccessor.h" -#include "arm_compute/graph/ITensorObject.h" -#include "arm_compute/graph/Tensor.h" -#include "arm_compute/graph/Types.h" -#include "support/ToolchainSupport.h" - -#include <memory> - -namespace arm_compute -{ -namespace graph -{ -/** SubTensor class */ -class SubTensor final : public ITensorObject -{ -public: - /** Default Constructor */ - SubTensor(); - /** Constructor - * - * @param[in] parent Parent to create sub-tensor from - * @param[in] tensor_shape Sub-tensor shape - * @param[in] coords Starting coordinates of the sub-tensor in the parent tensor - * @param[in] extend_parent (Optional) Extend parent with subtensor shape if subtensor indexes out of bounds - */ - SubTensor(Tensor &parent, TensorShape tensor_shape, Coordinates coords, bool extend_parent = false); - /** Constructor - * - * @param[in] parent Parent to create sub-tensor from - * @param[in] tensor_shape Sub-tensor shape - * @param[in] coords Starting coordinates of the sub-tensor in the parent tensor - * @param[in] target Execution target - * @param[in] extend_parent (Optional) Extend parent with subtensor shape if subtensor indexes out of bounds - */ - SubTensor(arm_compute::ITensor *parent, TensorShape tensor_shape, Coordinates coords, TargetHint target, bool extend_parent = false); - /** Prevent instances of this class from being copied (As this class contains pointers) */ - SubTensor(const SubTensor &) = delete; - /** Prevent instances of this class from being copied (As this class contains pointers) */ - SubTensor &operator=(const SubTensor &) = delete; - /** Allow instances of this class to be moved */ - SubTensor(SubTensor &&) = default; - /** Allow instances of this class to be moved */ - SubTensor &operator=(SubTensor &&) = default; - /** Default Destructor */ - ~SubTensor() = default; - - // Inherited methods overriden: - bool call_accessor() override; - bool has_accessor() const override; - arm_compute::ITensor *set_target(TargetHint target) override; - arm_compute::ITensor *tensor() override; - const arm_compute::ITensor *tensor() const override; - TargetHint target() const override; - void allocate() override; - -private: - /** Instantiates a sub-tensor */ - void instantiate_subtensor(); - -private: - TargetHint _target; /**< Target that this tensor is pinned on */ - TensorShape _tensor_shape; /**< SubTensor shape */ - Coordinates _coords; /**< SubTensor Coordinates */ - arm_compute::ITensor *_parent; /**< Parent tensor */ - std::unique_ptr<arm_compute::ITensor> _subtensor; /**< SubTensor */ - bool _extend_parent; /**< Parent extension flag */ -}; -} // namespace graph -} // namespace arm_compute -#endif /* __ARM_COMPUTE_GRAPH_SUBTENSOR_H__ */ diff --git a/arm_compute/graph/Tensor.h b/arm_compute/graph/Tensor.h index e5821dc812..5199ac2328 100644 --- a/arm_compute/graph/Tensor.h +++ b/arm_compute/graph/Tensor.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 ARM Limited. + * Copyright (c) 2018 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -24,99 +24,91 @@ #ifndef __ARM_COMPUTE_GRAPH_TENSOR_H__ #define __ARM_COMPUTE_GRAPH_TENSOR_H__ -#include "arm_compute/graph/ITensorAccessor.h" -#include "arm_compute/graph/ITensorObject.h" #include "arm_compute/graph/Types.h" -#include "support/ToolchainSupport.h" + +#include "arm_compute/graph/ITensorAccessor.h" +#include "arm_compute/graph/ITensorHandle.h" +#include "arm_compute/graph/TensorDescriptor.h" #include <memory> +#include <set> namespace arm_compute { namespace graph { -/** Tensor class */ -class Tensor final : public ITensorObject +/** Tensor object **/ +class Tensor final { public: - /** Constructor + /** Default constructor * - * @param[in] info Tensor info to use + * @param[in] id Tensor ID + * @param[in] desc Tensor information */ - Tensor(TensorInfo &&info); - /** Constructor + Tensor(TensorID id, TensorDescriptor desc); + /** Tensor ID accessor * - * @param[in] accessor Tensor accessor + * @return Tensor ID */ - template <typename AccessorType> - Tensor(std::unique_ptr<AccessorType> accessor) - : _target(TargetHint::DONT_CARE), _info(), _accessor(std::move(accessor)), _tensor(nullptr) - { - } - /** Constructor + TensorID id() const; + /** TensorInfo metadata accessor * - * @param[in] accessor Tensor accessor + * @return Tensor descriptor metadata */ - template <typename AccessorType> - Tensor(AccessorType &&accessor) - : _target(TargetHint::DONT_CARE), _info(), _accessor(arm_compute::support::cpp14::make_unique<AccessorType>(std::forward<AccessorType>(accessor))), _tensor(nullptr) - { - } - /** Constructor + TensorDescriptor &desc(); + /** TensorInfo metadata accessor * - * @param[in] info Tensor info to use - * @param[in] accessor Tensor accessor + * @return Tensor descriptor metadata */ - template <typename AccessorType> - Tensor(TensorInfo &&info, std::unique_ptr<AccessorType> &&accessor) - : _target(TargetHint::DONT_CARE), _info(info), _accessor(std::move(accessor)), _tensor(nullptr) - { - } - /** Constructor + const TensorDescriptor &desc() const; + /** Sets the backend tensor * - * @param[in] info Tensor info to use - * @param[in] accessor Tensor accessor + * @param[in] backend_tensor Backend tensor to set */ - template <typename AccessorType> - Tensor(TensorInfo &&info, AccessorType &&accessor) - : _target(TargetHint::DONT_CARE), _info(info), _accessor(arm_compute::support::cpp14::make_unique<AccessorType>(std::forward<AccessorType>(accessor))), _tensor(nullptr) - { - } - /** Default Destructor */ - ~Tensor() = default; - /** Move Constructor + void set_handle(std::unique_ptr<ITensorHandle> backend_tensor); + /** Backend tensor handle accessor * - * @param[in] src Tensor to move + * @return Backend tensor handle */ - Tensor(Tensor &&src) noexcept; - - /** Sets the given TensorInfo to the tensor + ITensorHandle *handle(); + /** Sets the backend tensor accessor * - * @param[in] info TensorInfo to set + * @param[in] accessor Accessor to set */ - void set_info(TensorInfo &&info); - /** Returns tensor's TensorInfo + void set_accessor(std::unique_ptr<ITensorAccessor> accessor); + /** Backend tensor accessor * - * @return TensorInfo of the tensor + * @return Backend tensor accessor */ - const TensorInfo &info() const; - /** Allocates and fills the tensor if needed */ - void allocate_and_fill_if_needed(); - - // Inherited methods overriden: - bool call_accessor() override; - bool has_accessor() const override; - arm_compute::ITensor *set_target(TargetHint target) override; - arm_compute::ITensor *tensor() override; - const arm_compute::ITensor *tensor() const override; - TargetHint target() const override; - void allocate() override; + ITensorAccessor *accessor(); + /** Calls accessor on tensor + * + * @return True if the accessor was called else false + */ + bool call_accessor(); + /** Binds the tensor with an edge + * + * @param[in] eid Edge ID that is bound to the tensor + */ + void bind_edge(EdgeID eid); + /** Unbinds an edge from a tensor + * + * @param[in] eid Edge to unbind + */ + void unbind_edge(EdgeID eid); + /** Accessor the edges that are bound with the tensor + * + * @return Bound edges + */ + const std::set<EdgeID> bound_edges() const; private: - TargetHint _target; /**< Target that this tensor is pinned on */ - TensorInfo _info; /**< Tensor metadata */ - std::unique_ptr<ITensorAccessor> _accessor; /**< Tensor Accessor */ - std::unique_ptr<arm_compute::ITensor> _tensor; /**< Tensor */ + TensorID _id; /**< Tensor id */ + TensorDescriptor _desc; /**< Tensor metadata */ + std::unique_ptr<ITensorHandle> _handle; /**< Tensor Handle */ + std::unique_ptr<ITensorAccessor> _accessor; /**< Tensor Accessor */ + std::set<EdgeID> _bound_edges; /**< Edges bound to this tensor */ }; } // namespace graph } // namespace arm_compute diff --git a/arm_compute/graph2/TensorDescriptor.h b/arm_compute/graph/TensorDescriptor.h index 1a69dc10e8..fc0095e3b9 100644 --- a/arm_compute/graph2/TensorDescriptor.h +++ b/arm_compute/graph/TensorDescriptor.h @@ -21,14 +21,14 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#ifndef __ARM_COMPUTE_GRAPH2_TENSOR_DESCRIPTOR_H__ -#define __ARM_COMPUTE_GRAPH2_TENSOR_DESCRIPTOR_H__ +#ifndef __ARM_COMPUTE_GRAPH_TENSOR_DESCRIPTOR_H__ +#define __ARM_COMPUTE_GRAPH_TENSOR_DESCRIPTOR_H__ -#include "arm_compute/graph2/Types.h" +#include "arm_compute/graph/Types.h" namespace arm_compute { -namespace graph2 +namespace graph { /** Tensor metadata class */ struct TensorDescriptor final @@ -50,6 +50,6 @@ struct TensorDescriptor final DataType data_type{ DataType::UNKNOWN }; /**< Data type */ Target target{ Target::UNSPECIFIED }; /**< Target */ }; -} // namespace graph2 +} // namespace graph } // namespace arm_compute -#endif /* __ARM_COMPUTE_GRAPH2_TENSOR_DESCRIPTOR_H__ */ +#endif /* __ARM_COMPUTE_GRAPH_TENSOR_DESCRIPTOR_H__ */ diff --git a/arm_compute/graph2/TypePrinter.h b/arm_compute/graph/TypePrinter.h index de675c4633..d9bc8376bd 100644 --- a/arm_compute/graph2/TypePrinter.h +++ b/arm_compute/graph/TypePrinter.h @@ -21,16 +21,16 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#ifndef __ARM_COMPUTE_GRAPH2_TYPE_PRINTER_H__ -#define __ARM_COMPUTE_GRAPH2_TYPE_PRINTER_H__ +#ifndef __ARM_COMPUTE_GRAPH_TYPE_PRINTER_H__ +#define __ARM_COMPUTE_GRAPH_TYPE_PRINTER_H__ #include "arm_compute/core/Error.h" #include "arm_compute/core/Types.h" -#include "arm_compute/graph2/Types.h" +#include "arm_compute/graph/Types.h" namespace arm_compute { -namespace graph2 +namespace graph { /** Formatted output of the Dimensions type. */ template <typename T> @@ -308,6 +308,6 @@ inline ::std::ostream &operator<<(::std::ostream &os, const PadStrideInfo &pad_s return os; } -} // namespace graph2 +} // namespace graph } // namespace arm_compute -#endif /* __ARM_COMPUTE_GRAPH2_TYPE_PRINTER_H__ */ +#endif /* __ARM_COMPUTE_GRAPH_TYPE_PRINTER_H__ */ diff --git a/arm_compute/graph/Types.h b/arm_compute/graph/Types.h index db5bbb8604..00d37a3354 100644 --- a/arm_compute/graph/Types.h +++ b/arm_compute/graph/Types.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018 ARM Limited. + * Copyright (c) 2018 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -24,96 +24,148 @@ #ifndef __ARM_COMPUTE_GRAPH_TYPES_H__ #define __ARM_COMPUTE_GRAPH_TYPES_H__ -#include "arm_compute/core/ITensor.h" -#include "arm_compute/core/SubTensorInfo.h" -#include "arm_compute/core/TensorInfo.h" -#include "arm_compute/core/utils/logging/Macros.h" +#include "arm_compute/core/Error.h" +#include "arm_compute/core/Types.h" +#include "arm_compute/core/utils/strong_type/StrongType.h" +#include "arm_compute/core/utils/strong_type/StrongTypeAttributes.h" -/** Create a default core logger - * - * @note It will eventually create all default loggers in don't exist - */ -#define ARM_COMPUTE_CREATE_DEFAULT_GRAPH_LOGGER() \ - do \ - { \ - if(arm_compute::logging::LoggerRegistry::get().logger("GRAPH") == nullptr) \ - { \ - arm_compute::logging::LoggerRegistry::get().create_reserved_loggers(); \ - } \ - } while(false) - -#define ARM_COMPUTE_LOG_GRAPH(log_level, x) \ - ARM_COMPUTE_CREATE_DEFAULT_GRAPH_LOGGER(); \ - ARM_COMPUTE_LOG_STREAM("GRAPH", log_level, x) - -#define ARM_COMPUTE_LOG_GRAPH_INFO(x) \ - ARM_COMPUTE_CREATE_DEFAULT_GRAPH_LOGGER(); \ - ARM_COMPUTE_LOG_STREAM("GRAPH", arm_compute::logging::LogLevel::INFO, x) +#include <limits> +#include <string> namespace arm_compute { namespace graph { -using arm_compute::ActivationLayerInfo; +using arm_compute::Status; + using arm_compute::Coordinates; using arm_compute::DataType; -using arm_compute::DimensionRoundingType; -using arm_compute::ITensorInfo; +using arm_compute::TensorShape; +using arm_compute::Size2D; + +using arm_compute::ActivationLayerInfo; using arm_compute::NormType; using arm_compute::NormalizationLayerInfo; using arm_compute::PadStrideInfo; using arm_compute::PoolingLayerInfo; using arm_compute::PoolingType; -using arm_compute::SubTensorInfo; -using arm_compute::TensorInfo; -using arm_compute::TensorShape; -using arm_compute::WeightsInfo; +using arm_compute::DimensionRoundingType; + +/** TODO (geopin01): Make ids strongly typed */ +using TensorID = unsigned int; +using NodeID = unsigned int; +using EdgeID = unsigned int; +using Activation = arm_compute::ActivationLayerInfo::ActivationFunction; + +/**< GraphID strong type */ +using GraphID = strong_type::StrongType<unsigned int, struct graph_id_t, strong_type::Comparable>; +/* TODO (geopin01): Strong types for NodeID */ + +/**< Constant TensorID specifying an equivalent of null tensor */ +constexpr TensorID NullTensorID = std::numeric_limits<TensorID>::max(); +/**< Constant NodeID specifying an equivalent of null node */ +constexpr NodeID EmptyNodeID = std::numeric_limits<NodeID>::max(); +/**< Constant EdgeID specifying an equivalent of null edge */ +constexpr EdgeID EmptyEdgeID = std::numeric_limits<EdgeID>::max(); + +// Forward declarations +class TensorDescriptor; + +/** Graph configuration structure */ +struct GraphConfig +{ + bool use_function_memory_manager{ false }; /**< Use a memory manager to manage per-funcion auxilary memory */ + bool use_transition_memory_manager{ false }; /**< Use a memory manager to manager transition buffer memory */ + bool use_tuner{ false }; /**< Use a tuner in tunable backends */ + unsigned int num_threads{ 0 }; /**< Number of threads to use (thread capable backends), if 0 the backend will auto-initialize */ +}; -using arm_compute::logging::LogLevel; -using arm_compute::ConvertPolicy; +/**< Data layout format */ +enum class DataLayout +{ + NCHW, /** N(Batches), C(Channels), H(Height), W(Width) from slow to fast moving dimension */ + NHWC /** N(Batches), H(Height), W(Width), C(Channels) from slow to fast moving dimension */ +}; + +/**< Device target types */ +enum class Target +{ + UNSPECIFIED, /**< Unspecified Target */ + NEON, /**< NEON capable target device */ + CL, /**< OpenCL capable target device */ + GC, /**< GLES compute capable target device */ +}; -/**< Execution hint to the graph executor */ -enum class TargetHint +/** Supported Element-wise operations */ +enum class EltwiseOperation { - DONT_CARE, /**< Run node in any device */ - OPENCL, /**< Run node on an OpenCL capable device (GPU) */ - NEON /**< Run node on a NEON capable device */ + ADD, /**< Arithmetic addition */ + SUB, /**< Arithmetic subtraction */ + MUL /**< Arithmetic multiplication */ }; -/** Convolution method hint to the graph executor */ -enum class ConvolutionMethodHint +/** Supported Convolution layer methods */ +enum class ConvolutionMethod { - GEMM, /**< Convolution using GEMM */ - DIRECT, /**< Direct convolution */ - WINOGRAD /**< Winograd convolution */ + DEFAULT, /**< Default approach using internal heuristics */ + GEMM, /**< GEMM based convolution */ + DIRECT, /**< Deep direct convolution */ + WINOGRAD /**< Winograd based convolution */ }; -/** Supported layer operations */ -enum class OperationType +/** Supported Depthwise Convolution layer methods */ +enum class DepthwiseConvolutionMethod +{ + DEFAULT, /**< Default approach using internal heuristics */ + GEMV, /**< Generic GEMV based depthwise convolution */ + OPTIMIZED_3x3, /**< Optimized 3x3 direct depthwise convolution */ +}; + +/** Supported nodes */ +enum class NodeType { ActivationLayer, - ArithmeticAddition, BatchNormalizationLayer, ConvolutionLayer, - DepthConvertLayer, + DepthConcatenateLayer, DepthwiseConvolutionLayer, - DequantizationLayer, + EltwiseLayer, FlattenLayer, - FloorLayer, FullyConnectedLayer, - L2NormalizeLayer, NormalizationLayer, PoolingLayer, - QuantizationLayer, ReshapeLayer, - SoftmaxLayer + SoftmaxLayer, + SplitLayer, + + Input, + Output, + Const, +}; + +/** Backend Memory Manager affinity **/ +enum class MemoryManagerAffinity +{ + Buffer, /**< Affinity at buffer level */ + Offset /**< Affinity at offset level */ +}; + +/** NodeID-index struct + * + * Used to describe connections + */ +struct NodeIdxPair +{ + NodeID node_id; /**< Node ID */ + size_t index; /**< Index */ }; -/** Branch layer merging method */ -enum class BranchMergeMethod +/** Common node parameters */ +struct NodeParams { - DEPTH_CONCATENATE /**< Concatenate across depth */ + std::string name; /**< Node name */ + Target target; /**< Node target */ }; } // namespace graph } // namespace arm_compute -#endif /*__ARM_COMPUTE_GRAPH_TYPES_H__*/ +#endif /* __ARM_COMPUTE_GRAPH_TYPES_H__ */ diff --git a/arm_compute/graph2/Utils.h b/arm_compute/graph/Utils.h index 0295bcb9af..83deb70348 100644 --- a/arm_compute/graph2/Utils.h +++ b/arm_compute/graph/Utils.h @@ -21,15 +21,15 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#ifndef __ARM_COMPUTE_GRAPH2_UTILS_H__ -#define __ARM_COMPUTE_GRAPH2_UTILS_H__ +#ifndef __ARM_COMPUTE_GRAPH_UTILS_H__ +#define __ARM_COMPUTE_GRAPH_UTILS_H__ -#include "arm_compute/graph2/Graph.h" -#include "arm_compute/graph2/PassManager.h" +#include "arm_compute/graph/Graph.h" +#include "arm_compute/graph/PassManager.h" namespace arm_compute { -namespace graph2 +namespace graph { // Forward Declaration class GraphContext; @@ -94,6 +94,6 @@ PassManager create_default_pass_manager(Target target); * @param[in] ctx Graph Context */ void setup_default_graph_context(GraphContext &ctx); -} // namespace graph2 +} // namespace graph } // namespace arm_compute -#endif /* __ARM_COMPUTE_GRAPH2_UTILS_H__ */ +#endif /* __ARM_COMPUTE_GRAPH_UTILS_H__ */ diff --git a/arm_compute/graph2/Workload.h b/arm_compute/graph/Workload.h index 85506e350e..b19c932636 100644 --- a/arm_compute/graph2/Workload.h +++ b/arm_compute/graph/Workload.h @@ -21,8 +21,8 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#ifndef __ARM_COMPUTE_GRAPH2_WORKLOAD_H__ -#define __ARM_COMPUTE_GRAPH2_WORKLOAD_H__ +#ifndef __ARM_COMPUTE_GRAPH_WORKLOAD_H__ +#define __ARM_COMPUTE_GRAPH_WORKLOAD_H__ #include "arm_compute/runtime/IFunction.h" @@ -31,7 +31,7 @@ namespace arm_compute { -namespace graph2 +namespace graph { // Forward declarations class ITensorHandle; @@ -61,6 +61,6 @@ struct ExecutionWorkload std::vector<Tensor *> outputs = {}; /**< Output handles */ std::vector<ExecutionTask> tasks = {}; /**< Execution workload */ }; -} // namespace graph2 +} // namespace graph } // namespace arm_compute -#endif /* __ARM_COMPUTE_GRAPH2_WORKLOAD_H__ */ +#endif /* __ARM_COMPUTE_GRAPH_WORKLOAD_H__ */ diff --git a/arm_compute/graph2/algorithms/Algorithms.h b/arm_compute/graph/algorithms/Algorithms.h index dfc36febe2..f89856f327 100644 --- a/arm_compute/graph2/algorithms/Algorithms.h +++ b/arm_compute/graph/algorithms/Algorithms.h @@ -21,9 +21,9 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#ifndef __ARM_COMPUTE_GRAPH2_ALGORITHMS_H__ -#define __ARM_COMPUTE_GRAPH2_ALGORITHMS_H__ +#ifndef __ARM_COMPUTE_GRAPH_ALGORITHMS_H__ +#define __ARM_COMPUTE_GRAPH_ALGORITHMS_H__ -#include "arm_compute/graph2/algorithms/BFS.h" +#include "arm_compute/graph/algorithms/BFS.h" -#endif /* __ARM_COMPUTE_GRAPH2_ALGORITHMS_H__ */ +#endif /* __ARM_COMPUTE_GRAPH_ALGORITHMS_H__ */ diff --git a/arm_compute/graph2/algorithms/BFS.h b/arm_compute/graph/algorithms/BFS.h index d590658074..36ca872f15 100644 --- a/arm_compute/graph2/algorithms/BFS.h +++ b/arm_compute/graph/algorithms/BFS.h @@ -21,17 +21,17 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#ifndef __ARM_COMPUTE_GRAPH2_ALGORITHM_BFS_H__ -#define __ARM_COMPUTE_GRAPH2_ALGORITHM_BFS_H__ +#ifndef __ARM_COMPUTE_GRAPH_ALGORITHM_BFS_H__ +#define __ARM_COMPUTE_GRAPH_ALGORITHM_BFS_H__ -#include "arm_compute/graph2/Graph.h" +#include "arm_compute/graph/Graph.h" #include <list> #include <vector> namespace arm_compute { -namespace graph2 +namespace graph { namespace detail { @@ -118,6 +118,6 @@ inline std::vector<NodeID> bfs(Graph &g) return bfs_order_vector; } -} // namespace graph2 +} // namespace graph } // namespace arm_compute -#endif /* __ARM_COMPUTE_GRAPH2_ALGORITHM_BFS_H__ */ +#endif /* __ARM_COMPUTE_GRAPH_ALGORITHM_BFS_H__ */ diff --git a/arm_compute/graph2/backends/BackendRegistrar.h b/arm_compute/graph/backends/BackendRegistrar.h index f9905a7f8f..f7f2f7f9d2 100644 --- a/arm_compute/graph2/backends/BackendRegistrar.h +++ b/arm_compute/graph/backends/BackendRegistrar.h @@ -21,17 +21,17 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#ifndef ARM_COMPUTE_GRAPH2_BACKEND_REGISTRAR_H__ -#define ARM_COMPUTE_GRAPH2_BACKEND_REGISTRAR_H__ +#ifndef ARM_COMPUTE_GRAPH_BACKEND_REGISTRAR_H__ +#define ARM_COMPUTE_GRAPH_BACKEND_REGISTRAR_H__ -#include "arm_compute/graph2/Types.h" -#include "arm_compute/graph2/backends/BackendRegistry.h" +#include "arm_compute/graph/Types.h" +#include "arm_compute/graph/backends/BackendRegistry.h" #include <utility> namespace arm_compute { -namespace graph2 +namespace graph { namespace backends { @@ -56,6 +56,6 @@ inline BackendRegistrar<T>::BackendRegistrar(Target target) } } // namespace detail } // namespace backends -} // namespace graph2 +} // namespace graph } // namespace arm_compute -#endif /* ARM_COMPUTE_GRAPH2_BACKEND_REGISTRAR_H__ */
\ No newline at end of file +#endif /* ARM_COMPUTE_GRAPH_BACKEND_REGISTRAR_H__ */
\ No newline at end of file diff --git a/arm_compute/graph2/backends/BackendRegistry.h b/arm_compute/graph/backends/BackendRegistry.h index 9481115009..69114ed26d 100644 --- a/arm_compute/graph2/backends/BackendRegistry.h +++ b/arm_compute/graph/backends/BackendRegistry.h @@ -21,11 +21,11 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#ifndef __ARM_COMPUTE_GRAPH2_BACKEND_REGISTRY_H__ -#define __ARM_COMPUTE_GRAPH2_BACKEND_REGISTRY_H__ +#ifndef __ARM_COMPUTE_GRAPH_BACKEND_REGISTRY_H__ +#define __ARM_COMPUTE_GRAPH_BACKEND_REGISTRY_H__ -#include "arm_compute/graph2/IDeviceBackend.h" -#include "arm_compute/graph2/Types.h" +#include "arm_compute/graph/IDeviceBackend.h" +#include "arm_compute/graph/Types.h" #include "support/ToolchainSupport.h" #include <map> @@ -33,7 +33,7 @@ namespace arm_compute { -namespace graph2 +namespace graph { namespace backends { @@ -86,6 +86,6 @@ inline void BackendRegistry::add_backend(Target target) _registered_backends[target] = support::cpp14::make_unique<T>(); } } // namespace backends -} // namespace graph2 +} // namespace graph } // namespace arm_compute -#endif /* __ARM_COMPUTE_GRAPH2_BACKEND_REGISTRY_H__ */ +#endif /* __ARM_COMPUTE_GRAPH_BACKEND_REGISTRY_H__ */ diff --git a/arm_compute/graph2/backends/CL/CLDeviceBackend.h b/arm_compute/graph/backends/CL/CLDeviceBackend.h index 3a70f0b112..5adbe0e1a8 100644 --- a/arm_compute/graph2/backends/CL/CLDeviceBackend.h +++ b/arm_compute/graph/backends/CL/CLDeviceBackend.h @@ -21,17 +21,17 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#ifndef __ARM_COMPUTE_GRAPH2_CLDEVICEBACKEND_H__ -#define __ARM_COMPUTE_GRAPH2_CLDEVICEBACKEND_H__ +#ifndef __ARM_COMPUTE_GRAPH_CLDEVICEBACKEND_H__ +#define __ARM_COMPUTE_GRAPH_CLDEVICEBACKEND_H__ -#include "arm_compute/graph2/IDeviceBackend.h" +#include "arm_compute/graph/IDeviceBackend.h" #include "arm_compute/runtime/CL/CLBufferAllocator.h" #include "arm_compute/runtime/CL/CLTuner.h" namespace arm_compute { -namespace graph2 +namespace graph { namespace backends { @@ -54,6 +54,7 @@ public: // Inherited overridden methods void initialize_backend() override; void setup_backend_context(GraphContext &ctx) override; + bool is_backend_supported() override; std::unique_ptr<ITensorHandle> create_tensor(const Tensor &tensor) override; std::unique_ptr<ITensorHandle> create_subtensor(ITensorHandle *parent, TensorShape shape, Coordinates coords, bool extend_parent) override; std::unique_ptr<arm_compute::IFunction> configure_node(INode &node, GraphContext &ctx) override; @@ -65,6 +66,6 @@ private: CLBufferAllocator _allocator; /**< CL buffer affinity allocator */ }; } // namespace backends -} // namespace graph2 +} // namespace graph } // namespace arm_compute -#endif //__ARM_COMPUTE_GRAPH2_CLDEVICEBACKEND_H__ +#endif //__ARM_COMPUTE_GRAPH_CLDEVICEBACKEND_H__ diff --git a/arm_compute/graph2/backends/CL/CLFunctionFactory.h b/arm_compute/graph/backends/CL/CLFunctionFactory.h index 94fd2b8be1..6caca547cf 100644 --- a/arm_compute/graph2/backends/CL/CLFunctionFactory.h +++ b/arm_compute/graph/backends/CL/CLFunctionFactory.h @@ -21,8 +21,8 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#ifndef __ARM_COMPUTE_GRAPH2_CLFUNCTIONFACTORY_H__ -#define __ARM_COMPUTE_GRAPH2_CLFUNCTIONFACTORY_H__ +#ifndef __ARM_COMPUTE_GRAPH_CLFUNCTIONFACTORY_H__ +#define __ARM_COMPUTE_GRAPH_CLFUNCTIONFACTORY_H__ #include "arm_compute/runtime/IFunction.h" @@ -30,7 +30,7 @@ namespace arm_compute { -namespace graph2 +namespace graph { // Forward declarations class INode; @@ -52,6 +52,6 @@ public: static std::unique_ptr<arm_compute::IFunction> create(INode *node, GraphContext &ctx); }; } // namespace backends -} // namespace graph2 +} // namespace graph } // namespace arm_compute -#endif //__ARM_COMPUTE_GRAPH2_CLFUNCTIONFACTORY_H__ +#endif //__ARM_COMPUTE_GRAPH_CLFUNCTIONFACTORY_H__ diff --git a/arm_compute/graph2/backends/CL/CLNodeValidator.h b/arm_compute/graph/backends/CL/CLNodeValidator.h index 251f705eee..9bd4842cf7 100644 --- a/arm_compute/graph2/backends/CL/CLNodeValidator.h +++ b/arm_compute/graph/backends/CL/CLNodeValidator.h @@ -21,14 +21,14 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#ifndef __ARM_COMPUTE_GRAPH2_CLNODEVALIDATOR_H__ -#define __ARM_COMPUTE_GRAPH2_CLNODEVALIDATOR_H__ +#ifndef __ARM_COMPUTE_GRAPH_CLNODEVALIDATOR_H__ +#define __ARM_COMPUTE_GRAPH_CLNODEVALIDATOR_H__ #include "arm_compute/core/Error.h" namespace arm_compute { -namespace graph2 +namespace graph { // Forward declarations class INode; @@ -47,6 +47,6 @@ public: static Status validate(INode *node); }; } // namespace backends -} // namespace graph2 +} // namespace graph } // namespace arm_compute -#endif //__ARM_COMPUTE_GRAPH2_CLNODEVALIDATOR_H__ +#endif //__ARM_COMPUTE_GRAPH_CLNODEVALIDATOR_H__ diff --git a/arm_compute/graph2/backends/CL/CLSubTensorHandle.h b/arm_compute/graph/backends/CL/CLSubTensorHandle.h index 6f3c00c041..4be5842c70 100644 --- a/arm_compute/graph2/backends/CL/CLSubTensorHandle.h +++ b/arm_compute/graph/backends/CL/CLSubTensorHandle.h @@ -21,16 +21,16 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#ifndef __ARM_COMPUTE_GRAPH2_CLSUBTENSORHANDLE_H__ -#define __ARM_COMPUTE_GRAPH2_CLSUBTENSORHANDLE_H__ +#ifndef __ARM_COMPUTE_GRAPH_CLSUBTENSORHANDLE_H__ +#define __ARM_COMPUTE_GRAPH_CLSUBTENSORHANDLE_H__ -#include "arm_compute/graph2/ITensorHandle.h" +#include "arm_compute/graph/ITensorHandle.h" #include "arm_compute/runtime/CL/CLSubTensor.h" namespace arm_compute { -namespace graph2 +namespace graph { namespace backends { @@ -66,6 +66,6 @@ private: arm_compute::CLSubTensor _sub_tensor; /**< Backend Sub-Tensor */ }; } // namespace backends -} // namespace graph2 +} // namespace graph } // namespace arm_compute -#endif /* __ARM_COMPUTE_GRAPH2_CLSUBTENSORHANDLE_H__ */ +#endif /* __ARM_COMPUTE_GRAPH_CLSUBTENSORHANDLE_H__ */ diff --git a/arm_compute/graph2/backends/CL/CLTensorHandle.h b/arm_compute/graph/backends/CL/CLTensorHandle.h index 0b20d1d8fc..8f5a70cbbb 100644 --- a/arm_compute/graph2/backends/CL/CLTensorHandle.h +++ b/arm_compute/graph/backends/CL/CLTensorHandle.h @@ -21,16 +21,16 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#ifndef __ARM_COMPUTE_GRAPH2_CLTENSORHANDLE_H__ -#define __ARM_COMPUTE_GRAPH2_CLTENSORHANDLE_H__ +#ifndef __ARM_COMPUTE_GRAPH_CLTENSORHANDLE_H__ +#define __ARM_COMPUTE_GRAPH_CLTENSORHANDLE_H__ -#include "arm_compute/graph2/ITensorHandle.h" +#include "arm_compute/graph/ITensorHandle.h" #include "arm_compute/runtime/CL/CLTensor.h" namespace arm_compute { -namespace graph2 +namespace graph { namespace backends { @@ -63,6 +63,6 @@ private: arm_compute::CLTensor _tensor; /**< Backend Tensor */ }; } // namespace backends -} // namespace graph2 +} // namespace graph } // namespace arm_compute -#endif /* __ARM_COMPUTE_GRAPH2_CLTENSORHANDLE_H__ */ +#endif /* __ARM_COMPUTE_GRAPH_CLTENSORHANDLE_H__ */ diff --git a/arm_compute/graph2/backends/GLES/GCDeviceBackend.h b/arm_compute/graph/backends/GLES/GCDeviceBackend.h index 22ba91496b..be81a8f1f2 100644 --- a/arm_compute/graph2/backends/GLES/GCDeviceBackend.h +++ b/arm_compute/graph/backends/GLES/GCDeviceBackend.h @@ -21,16 +21,16 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#ifndef __ARM_COMPUTE_GRAPH2_GCDEVICEBACKEND_H__ -#define __ARM_COMPUTE_GRAPH2_GCDEVICEBACKEND_H__ +#ifndef __ARM_COMPUTE_GRAPH_GCDEVICEBACKEND_H__ +#define __ARM_COMPUTE_GRAPH_GCDEVICEBACKEND_H__ -#include "arm_compute/graph2/IDeviceBackend.h" +#include "arm_compute/graph/IDeviceBackend.h" #include "arm_compute/runtime/GLES_COMPUTE/GCBufferAllocator.h" namespace arm_compute { -namespace graph2 +namespace graph { namespace backends { @@ -44,6 +44,7 @@ public: // Inherited overridden methods void initialize_backend() override; void setup_backend_context(GraphContext &ctx) override; + bool is_backend_supported() override; std::unique_ptr<ITensorHandle> create_tensor(const Tensor &tensor) override; std::unique_ptr<ITensorHandle> create_subtensor(ITensorHandle *parent, TensorShape shape, Coordinates coords, bool extend_parent) override; std::unique_ptr<arm_compute::IFunction> configure_node(INode &node, GraphContext &ctx) override; @@ -54,6 +55,6 @@ private: GCBufferAllocator _allocator; /**< GLES buffer affinity allocator */ }; } // namespace backends -} // namespace graph2 +} // namespace graph } // namespace arm_compute -#endif //__ARM_COMPUTE_GRAPH2_GCDEVICEBACKEND_H__ +#endif //__ARM_COMPUTE_GRAPH_GCDEVICEBACKEND_H__ diff --git a/arm_compute/graph2/backends/GLES/GCFunctionFactory.h b/arm_compute/graph/backends/GLES/GCFunctionFactory.h index 4f7b2f451a..c819c034f6 100644 --- a/arm_compute/graph2/backends/GLES/GCFunctionFactory.h +++ b/arm_compute/graph/backends/GLES/GCFunctionFactory.h @@ -21,8 +21,8 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#ifndef __ARM_COMPUTE_GRAPH2_GCFUNCTIONFACTORY_H__ -#define __ARM_COMPUTE_GRAPH2_GCFUNCTIONFACTORY_H__ +#ifndef __ARM_COMPUTE_GRAPH_GCFUNCTIONFACTORY_H__ +#define __ARM_COMPUTE_GRAPH_GCFUNCTIONFACTORY_H__ #include "arm_compute/runtime/IFunction.h" @@ -30,7 +30,7 @@ namespace arm_compute { -namespace graph2 +namespace graph { // Forward declarations class INode; @@ -52,6 +52,6 @@ public: static std::unique_ptr<arm_compute::IFunction> create(INode *node, GraphContext &ctx); }; } // namespace backends -} // namespace graph2 +} // namespace graph } // namespace arm_compute -#endif //__ARM_COMPUTE_GRAPH2_GCFUNCTIONFACTORY_H__ +#endif //__ARM_COMPUTE_GRAPH_GCFUNCTIONFACTORY_H__ diff --git a/arm_compute/graph2/backends/GLES/GCNodeValidator.h b/arm_compute/graph/backends/GLES/GCNodeValidator.h index 16b225b282..6fdfbdd894 100644 --- a/arm_compute/graph2/backends/GLES/GCNodeValidator.h +++ b/arm_compute/graph/backends/GLES/GCNodeValidator.h @@ -21,14 +21,14 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#ifndef __ARM_COMPUTE_GRAPH2_GCNODEVALIDATOR_H__ -#define __ARM_COMPUTE_GRAPH2_GCNODEVALIDATOR_H__ +#ifndef __ARM_COMPUTE_GRAPH_GCNODEVALIDATOR_H__ +#define __ARM_COMPUTE_GRAPH_GCNODEVALIDATOR_H__ #include "arm_compute/core/Error.h" namespace arm_compute { -namespace graph2 +namespace graph { // Forward declarations class INode; @@ -47,6 +47,6 @@ public: static Status validate(INode *node); }; } // namespace backends -} // namespace graph2 +} // namespace graph } // namespace arm_compute -#endif //__ARM_COMPUTE_GRAPH2_GCNODEVALIDATOR_H__ +#endif //__ARM_COMPUTE_GRAPH_GCNODEVALIDATOR_H__ diff --git a/arm_compute/graph2/backends/GLES/GCTensorHandle.h b/arm_compute/graph/backends/GLES/GCTensorHandle.h index 281adee428..774268fd3f 100644 --- a/arm_compute/graph2/backends/GLES/GCTensorHandle.h +++ b/arm_compute/graph/backends/GLES/GCTensorHandle.h @@ -21,16 +21,16 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#ifndef __ARM_COMPUTE_GRAPH2_GCTENSORHANDLE_H__ -#define __ARM_COMPUTE_GRAPH2_GCTENSORHANDLE_H__ +#ifndef __ARM_COMPUTE_GRAPH_GCTENSORHANDLE_H__ +#define __ARM_COMPUTE_GRAPH_GCTENSORHANDLE_H__ -#include "arm_compute/graph2/ITensorHandle.h" +#include "arm_compute/graph/ITensorHandle.h" #include "arm_compute/runtime/GLES_COMPUTE/GCTensor.h" namespace arm_compute { -namespace graph2 +namespace graph { namespace backends { @@ -63,6 +63,6 @@ private: arm_compute::GCTensor _tensor; /**< Backend Tensor */ }; } // namespace backends -} // namespace graph2 +} // namespace graph } // namespace arm_compute -#endif /* __ARM_COMPUTE_GRAPH2_GCTENSORHANDLE_H__ */ +#endif /* __ARM_COMPUTE_GRAPH_GCTENSORHANDLE_H__ */ diff --git a/arm_compute/graph2/backends/NEON/NEDeviceBackend.h b/arm_compute/graph/backends/NEON/NEDeviceBackend.h index e81e9d921e..b23c83adea 100644 --- a/arm_compute/graph2/backends/NEON/NEDeviceBackend.h +++ b/arm_compute/graph/backends/NEON/NEDeviceBackend.h @@ -21,16 +21,16 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#ifndef __ARM_COMPUTE_GRAPH2_NEDEVICEBACKEND_H__ -#define __ARM_COMPUTE_GRAPH2_NEDEVICEBACKEND_H__ +#ifndef __ARM_COMPUTE_GRAPH_NEDEVICEBACKEND_H__ +#define __ARM_COMPUTE_GRAPH_NEDEVICEBACKEND_H__ -#include "arm_compute/graph2/IDeviceBackend.h" +#include "arm_compute/graph/IDeviceBackend.h" #include "arm_compute/runtime/Allocator.h" namespace arm_compute { -namespace graph2 +namespace graph { namespace backends { @@ -43,6 +43,7 @@ public: // Inherited overridden methods void initialize_backend() override; void setup_backend_context(GraphContext &ctx) override; + bool is_backend_supported() override; std::unique_ptr<ITensorHandle> create_tensor(const Tensor &tensor) override; std::unique_ptr<ITensorHandle> create_subtensor(ITensorHandle *parent, TensorShape shape, Coordinates coords, bool extend_parent) override; std::unique_ptr<arm_compute::IFunction> configure_node(INode &node, GraphContext &ctx) override; @@ -53,6 +54,6 @@ private: Allocator _allocator; /**< NEON backend allocator */ }; } // namespace backends -} // namespace graph2 +} // namespace graph } // namespace arm_compute -#endif //__ARM_COMPUTE_GRAPH2_NEDEVICEBACKEND_H__ +#endif //__ARM_COMPUTE_GRAPH_NEDEVICEBACKEND_H__ diff --git a/arm_compute/graph2/backends/NEON/NEFunctionFactory.h b/arm_compute/graph/backends/NEON/NEFunctionFactory.h index 09ca49ae6c..1143c29c5b 100644 --- a/arm_compute/graph2/backends/NEON/NEFunctionFactory.h +++ b/arm_compute/graph/backends/NEON/NEFunctionFactory.h @@ -21,8 +21,8 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#ifndef __ARM_COMPUTE_GRAPH2_NEFUNCTIONFACTORY_H__ -#define __ARM_COMPUTE_GRAPH2_NEFUNCTIONFACTORY_H__ +#ifndef __ARM_COMPUTE_GRAPH_NEFUNCTIONFACTORY_H__ +#define __ARM_COMPUTE_GRAPH_NEFUNCTIONFACTORY_H__ #include "arm_compute/runtime/IFunction.h" @@ -30,7 +30,7 @@ namespace arm_compute { -namespace graph2 +namespace graph { // Forward declarations class INode; @@ -52,6 +52,6 @@ public: static std::unique_ptr<arm_compute::IFunction> create(INode *node, GraphContext &ctx); }; } // namespace backends -} // namespace graph2 +} // namespace graph } // namespace arm_compute -#endif //__ARM_COMPUTE_GRAPH2_NEFUNCTIONFACTORY_H__ +#endif //__ARM_COMPUTE_GRAPH_NEFUNCTIONFACTORY_H__ diff --git a/arm_compute/graph2/backends/NEON/NENodeValidator.h b/arm_compute/graph/backends/NEON/NENodeValidator.h index d39ab15a27..38f58a9d91 100644 --- a/arm_compute/graph2/backends/NEON/NENodeValidator.h +++ b/arm_compute/graph/backends/NEON/NENodeValidator.h @@ -21,14 +21,14 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#ifndef __ARM_COMPUTE_GRAPH2_NENODEVALIDATOR_H__ -#define __ARM_COMPUTE_GRAPH2_NENODEVALIDATOR_H__ +#ifndef __ARM_COMPUTE_GRAPH_NENODEVALIDATOR_H__ +#define __ARM_COMPUTE_GRAPH_NENODEVALIDATOR_H__ #include "arm_compute/core/Error.h" namespace arm_compute { -namespace graph2 +namespace graph { // Forward declarations class INode; @@ -47,6 +47,6 @@ public: static Status validate(INode *node); }; } // namespace backends -} // namespace graph2 +} // namespace graph } // namespace arm_compute -#endif //__ARM_COMPUTE_GRAPH2_NENODEVALIDATOR_H__ +#endif //__ARM_COMPUTE_GRAPH_NENODEVALIDATOR_H__ diff --git a/arm_compute/graph2/backends/NEON/NESubTensorHandle.h b/arm_compute/graph/backends/NEON/NESubTensorHandle.h index d62b66f343..11dcec60f3 100644 --- a/arm_compute/graph2/backends/NEON/NESubTensorHandle.h +++ b/arm_compute/graph/backends/NEON/NESubTensorHandle.h @@ -21,16 +21,16 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#ifndef __ARM_COMPUTE_GRAPH2_NESUBTENSORHANDLE_H__ -#define __ARM_COMPUTE_GRAPH2_NESUBTENSORHANDLE_H__ +#ifndef __ARM_COMPUTE_GRAPH_NESUBTENSORHANDLE_H__ +#define __ARM_COMPUTE_GRAPH_NESUBTENSORHANDLE_H__ -#include "arm_compute/graph2/ITensorHandle.h" +#include "arm_compute/graph/ITensorHandle.h" #include "arm_compute/runtime/SubTensor.h" namespace arm_compute { -namespace graph2 +namespace graph { namespace backends { @@ -66,6 +66,6 @@ private: arm_compute::SubTensor _sub_tensor; /**< Backend Sub-Tensor */ }; } // namespace backends -} // namespace graph2 +} // namespace graph } // namespace arm_compute -#endif /* __ARM_COMPUTE_GRAPH2_NESUBTENSORHANDLE_H__ */ +#endif /* __ARM_COMPUTE_GRAPH_NESUBTENSORHANDLE_H__ */ diff --git a/arm_compute/graph2/backends/NEON/NETensorHandle.h b/arm_compute/graph/backends/NEON/NETensorHandle.h index 23fd7ccc69..06ccdd83cc 100644 --- a/arm_compute/graph2/backends/NEON/NETensorHandle.h +++ b/arm_compute/graph/backends/NEON/NETensorHandle.h @@ -21,16 +21,16 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#ifndef __ARM_COMPUTE_GRAPH2_NETENSORHANDLE_H__ -#define __ARM_COMPUTE_GRAPH2_NETENSORHANDLE_H__ +#ifndef __ARM_COMPUTE_GRAPH_NETENSORHANDLE_H__ +#define __ARM_COMPUTE_GRAPH_NETENSORHANDLE_H__ -#include "arm_compute/graph2/ITensorHandle.h" +#include "arm_compute/graph/ITensorHandle.h" #include "arm_compute/runtime/Tensor.h" namespace arm_compute { -namespace graph2 +namespace graph { namespace backends { @@ -63,6 +63,6 @@ private: arm_compute::Tensor _tensor; /**< Backend Tensor */ }; } // namespace backends -} // namespace graph2 +} // namespace graph } // namespace arm_compute -#endif /* __ARM_COMPUTE_GRAPH2_NETENSORHANDLE_H__ */ +#endif /* __ARM_COMPUTE_GRAPH_NETENSORHANDLE_H__ */ diff --git a/arm_compute/graph2/backends/Utils.h b/arm_compute/graph/backends/Utils.h index bba75757eb..b902d17c0e 100644 --- a/arm_compute/graph2/backends/Utils.h +++ b/arm_compute/graph/backends/Utils.h @@ -21,15 +21,15 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#ifndef __ARM_COMPUTE_GRAPH2_BACKENDS_UTILS_H__ -#define __ARM_COMPUTE_GRAPH2_BACKENDS_UTILS_H__ +#ifndef __ARM_COMPUTE_GRAPH_BACKENDS_UTILS_H__ +#define __ARM_COMPUTE_GRAPH_BACKENDS_UTILS_H__ -#include "arm_compute/graph2/GraphContext.h" +#include "arm_compute/graph/GraphContext.h" #include "arm_compute/runtime/IMemoryManager.h" namespace arm_compute { -namespace graph2 +namespace graph { namespace backends { @@ -91,7 +91,7 @@ inline std::shared_ptr<IMemoryManager> get_memory_manager(GraphContext &ctx, Tar return enabled ? ctx.memory_management_ctx(target)->mm : nullptr; } } // namespace backends -} // namespace graph2 +} // namespace graph } // namespace arm_compute -#endif /* __ARM_COMPUTE_GRAPH2_BACKENDS_UTILS_H__ */ +#endif /* __ARM_COMPUTE_GRAPH_BACKENDS_UTILS_H__ */ diff --git a/arm_compute/graph2/backends/ValidateHelpers.h b/arm_compute/graph/backends/ValidateHelpers.h index 0c93f0f138..ca01295d15 100644 --- a/arm_compute/graph2/backends/ValidateHelpers.h +++ b/arm_compute/graph/backends/ValidateHelpers.h @@ -21,20 +21,20 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#ifndef __ARM_COMPUTE_GRAPH2_BACKENDS_DETAIL_VALIDATE_HELPERS_H__ -#define __ARM_COMPUTE_GRAPH2_BACKENDS_DETAIL_VALIDATE_HELPERS_H__ +#ifndef __ARM_COMPUTE_GRAPH_BACKENDS_DETAIL_VALIDATE_HELPERS_H__ +#define __ARM_COMPUTE_GRAPH_BACKENDS_DETAIL_VALIDATE_HELPERS_H__ -#include "arm_compute/graph2/Logger.h" -#include "arm_compute/graph2/Tensor.h" -#include "arm_compute/graph2/Types.h" -#include "arm_compute/graph2/nodes/Nodes.h" +#include "arm_compute/graph/Logger.h" +#include "arm_compute/graph/Tensor.h" +#include "arm_compute/graph/Types.h" +#include "arm_compute/graph/nodes/Nodes.h" #include "arm_compute/core/Error.h" #include "arm_compute/core/ITensorInfo.h" namespace arm_compute { -namespace graph2 +namespace graph { namespace backends { @@ -46,7 +46,7 @@ namespace detail * * @return Backing tensor tensor info if present else nullptr */ -inline arm_compute::ITensorInfo *get_backing_tensor_info(arm_compute::graph2::Tensor *tensor) +inline arm_compute::ITensorInfo *get_backing_tensor_info(arm_compute::graph::Tensor *tensor) { return ((tensor == nullptr) || (tensor->handle() == nullptr)) ? nullptr : tensor->handle()->tensor().info(); } @@ -97,6 +97,7 @@ Status validate_convolution_layer(ConvolutionLayerNode &node) // If validation fails try the Default approach if(!bool(status) || (conv_algorithm == ConvolutionMethod::DEFAULT)) { + std::cout << status.error_description() << std::endl; status = ConvolutionLayer::validate(input, weights, biases, output, conv_info); if(bool(status)) { @@ -143,7 +144,7 @@ Status validate_depthwise_convolution_layer(DepthwiseConvolutionLayerNode &node) } } // namespace detail } // namespace backends -} // namespace graph2 +} // namespace graph } // namespace arm_compute -#endif /* __ARM_COMPUTE_GRAPH2_BACKENDS_DETAIL_VALIDATE_HELPERS_H__ */ +#endif /* __ARM_COMPUTE_GRAPH_BACKENDS_DETAIL_VALIDATE_HELPERS_H__ */ diff --git a/arm_compute/graph2/detail/ExecutionHelpers.h b/arm_compute/graph/detail/ExecutionHelpers.h index bc3cfd5d72..52304d6836 100644 --- a/arm_compute/graph2/detail/ExecutionHelpers.h +++ b/arm_compute/graph/detail/ExecutionHelpers.h @@ -21,14 +21,14 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#ifndef __ARM_COMPUTE_GRAPH2_DETAIL_EXECUTION_HELPERS_H__ -#define __ARM_COMPUTE_GRAPH2_DETAIL_EXECUTION_HELPERS_H__ +#ifndef __ARM_COMPUTE_GRAPH_DETAIL_EXECUTION_HELPERS_H__ +#define __ARM_COMPUTE_GRAPH_DETAIL_EXECUTION_HELPERS_H__ -#include "arm_compute/graph2/Types.h" +#include "arm_compute/graph/Types.h" namespace arm_compute { -namespace graph2 +namespace graph { // Forward declarations class Graph; @@ -94,6 +94,6 @@ void call_all_output_node_accessors(ExecutionWorkload &workload); */ void call_all_tasks(ExecutionWorkload &workload); } // namespace detail -} // namespace graph2 +} // namespace graph } // namespace arm_compute -#endif /* __ARM_COMPUTE_GRAPH2_DETAIL_EXECUTION_HELPERS_H__ */ +#endif /* __ARM_COMPUTE_GRAPH_DETAIL_EXECUTION_HELPERS_H__ */ diff --git a/arm_compute/graph2/frontend/ILayer.h b/arm_compute/graph/frontend/ILayer.h index f8f6a5d47e..5add8ab440 100644 --- a/arm_compute/graph2/frontend/ILayer.h +++ b/arm_compute/graph/frontend/ILayer.h @@ -21,12 +21,12 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#ifndef __ARM_COMPUTE_GRAPH2_ILAYER_H__ -#define __ARM_COMPUTE_GRAPH2_ILAYER_H__ +#ifndef __ARM_COMPUTE_GRAPH_ILAYER_H__ +#define __ARM_COMPUTE_GRAPH_ILAYER_H__ namespace arm_compute { -namespace graph2 +namespace graph { namespace frontend { @@ -48,6 +48,6 @@ public: virtual NodeID create_layer(IStream &s) = 0; }; } // namespace frontend -} // namespace graph2 +} // namespace graph } // namespace arm_compute -#endif /* __ARM_COMPUTE_GRAPH2_ILAYER_H__ */ +#endif /* __ARM_COMPUTE_GRAPH_ILAYER_H__ */ diff --git a/arm_compute/graph2/frontend/IStream.h b/arm_compute/graph/frontend/IStream.h index 110be5230d..13995f9cf9 100644 --- a/arm_compute/graph2/frontend/IStream.h +++ b/arm_compute/graph/frontend/IStream.h @@ -21,14 +21,14 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#ifndef __ARM_COMPUTE_GRAPH2_ISTREAM_H__ -#define __ARM_COMPUTE_GRAPH2_ISTREAM_H__ +#ifndef __ARM_COMPUTE_GRAPH_ISTREAM_H__ +#define __ARM_COMPUTE_GRAPH_ISTREAM_H__ -#include "arm_compute/graph2/frontend/Types.h" +#include "arm_compute/graph/frontend/Types.h" namespace arm_compute { -namespace graph2 +namespace graph { // Forward declarations class Graph; @@ -88,6 +88,6 @@ protected: NodeID _tail_node = { EmptyNodeID }; /**< NodeID pointing to the last(tail) node of the graph */ }; } // namespace frontend -} // namespace graph2 +} // namespace graph } // namespace arm_compute -#endif /* __ARM_COMPUTE_GRAPH2_ISTREAM_H__ */ +#endif /* __ARM_COMPUTE_GRAPH_ISTREAM_H__ */ diff --git a/arm_compute/graph2/frontend/IStreamOperators.h b/arm_compute/graph/frontend/IStreamOperators.h index 1798e4a4ab..1eb6522935 100644 --- a/arm_compute/graph2/frontend/IStreamOperators.h +++ b/arm_compute/graph/frontend/IStreamOperators.h @@ -21,15 +21,15 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#ifndef __ARM_COMPUTE_GRAPH2_ISTREAM_OPERATORS_H__ -#define __ARM_COMPUTE_GRAPH2_ISTREAM_OPERATORS_H__ +#ifndef __ARM_COMPUTE_GRAPH_ISTREAM_OPERATORS_H__ +#define __ARM_COMPUTE_GRAPH_ISTREAM_OPERATORS_H__ -#include "arm_compute/graph2/frontend/IStream.h" -#include "arm_compute/graph2/frontend/Types.h" +#include "arm_compute/graph/frontend/IStream.h" +#include "arm_compute/graph/frontend/Types.h" namespace arm_compute { -namespace graph2 +namespace graph { namespace frontend { @@ -85,6 +85,6 @@ inline IStream &operator<<(IStream &s, DepthwiseConvolutionMethod depthwise_conv return s; } } // namespace frontend -} // namespace graph2 +} // namespace graph } // namespace arm_compute -#endif /* __ARM_COMPUTE_GRAPH2_ISTREAM_OPERATORS_H__ */ +#endif /* __ARM_COMPUTE_GRAPH_ISTREAM_OPERATORS_H__ */ diff --git a/arm_compute/graph2/frontend/Layers.h b/arm_compute/graph/frontend/Layers.h index 779b471b52..22133b8376 100644 --- a/arm_compute/graph2/frontend/Layers.h +++ b/arm_compute/graph/frontend/Layers.h @@ -21,14 +21,14 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#ifndef __ARM_COMPUTE_GRAPH2_LAYERS_H__ -#define __ARM_COMPUTE_GRAPH2_LAYERS_H__ +#ifndef __ARM_COMPUTE_GRAPH_LAYERS_H__ +#define __ARM_COMPUTE_GRAPH_LAYERS_H__ -#include "arm_compute/graph2/GraphBuilder.h" -#include "arm_compute/graph2/Types.h" -#include "arm_compute/graph2/frontend/ILayer.h" -#include "arm_compute/graph2/frontend/IStream.h" -#include "arm_compute/graph2/frontend/SubStream.h" +#include "arm_compute/graph/GraphBuilder.h" +#include "arm_compute/graph/Types.h" +#include "arm_compute/graph/frontend/ILayer.h" +#include "arm_compute/graph/frontend/IStream.h" +#include "arm_compute/graph/frontend/SubStream.h" #include "arm_compute/core/utils/misc/Utility.h" @@ -37,7 +37,7 @@ namespace arm_compute { -namespace graph2 +namespace graph { namespace frontend { @@ -466,6 +466,6 @@ private: std::vector<std::unique_ptr<SubStream>> _sub_streams; }; } // namespace frontend -} // namespace graph2 +} // namespace graph } // namespace arm_compute -#endif /* __ARM_COMPUTE_GRAPH2_LAYERS_H__ */ +#endif /* __ARM_COMPUTE_GRAPH_LAYERS_H__ */ diff --git a/arm_compute/graph2/frontend/Stream.h b/arm_compute/graph/frontend/Stream.h index bfefe12225..244d18e753 100644 --- a/arm_compute/graph2/frontend/Stream.h +++ b/arm_compute/graph/frontend/Stream.h @@ -21,20 +21,20 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#ifndef __ARM_COMPUTE_GRAPH2_STREAM_H__ -#define __ARM_COMPUTE_GRAPH2_STREAM_H__ +#ifndef __ARM_COMPUTE_GRAPH_STREAM_H__ +#define __ARM_COMPUTE_GRAPH_STREAM_H__ -#include "arm_compute/graph2/frontend/IStream.h" -#include "arm_compute/graph2/frontend/IStreamOperators.h" -#include "arm_compute/graph2/frontend/Types.h" +#include "arm_compute/graph/frontend/IStream.h" +#include "arm_compute/graph/frontend/IStreamOperators.h" +#include "arm_compute/graph/frontend/Types.h" -#include "arm_compute/graph2/Graph.h" -#include "arm_compute/graph2/GraphContext.h" -#include "arm_compute/graph2/GraphManager.h" +#include "arm_compute/graph/Graph.h" +#include "arm_compute/graph/GraphContext.h" +#include "arm_compute/graph/GraphManager.h" namespace arm_compute { -namespace graph2 +namespace graph { namespace frontend { @@ -79,6 +79,6 @@ private: Graph _g; /**< Internal graph representation of the stream */ }; } // namespace frontend -} // namespace graph2 +} // namespace graph } // namespace arm_compute -#endif /* __ARM_COMPUTE_GRAPH2_STREAM_H__ */
\ No newline at end of file +#endif /* __ARM_COMPUTE_GRAPH_STREAM_H__ */
\ No newline at end of file diff --git a/arm_compute/graph2/frontend/SubStream.h b/arm_compute/graph/frontend/SubStream.h index dee09b76ea..c084899c66 100644 --- a/arm_compute/graph2/frontend/SubStream.h +++ b/arm_compute/graph/frontend/SubStream.h @@ -21,19 +21,19 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#ifndef __ARM_COMPUTE_GRAPH2_SUB_STREAM_H__ -#define __ARM_COMPUTE_GRAPH2_SUB_STREAM_H__ +#ifndef __ARM_COMPUTE_GRAPH_SUB_STREAM_H__ +#define __ARM_COMPUTE_GRAPH_SUB_STREAM_H__ -#include "arm_compute/graph2/frontend/IStream.h" -#include "arm_compute/graph2/frontend/IStreamOperators.h" -#include "arm_compute/graph2/frontend/Types.h" +#include "arm_compute/graph/frontend/IStream.h" +#include "arm_compute/graph/frontend/IStreamOperators.h" +#include "arm_compute/graph/frontend/Types.h" #include <memory> #include <vector> namespace arm_compute { -namespace graph2 +namespace graph { // Forward declarations class Graph; @@ -70,6 +70,6 @@ private: IStream &_s; /**< Parent stream (assume that the lifetime of the parent is longer) */ }; } // namespace frontend -} // namespace graph2 +} // namespace graph } // namespace arm_compute -#endif /* __ARM_COMPUTE_GRAPH2_SUB_STREAM_H__ */ +#endif /* __ARM_COMPUTE_GRAPH_SUB_STREAM_H__ */ diff --git a/arm_compute/graph2/frontend/Types.h b/arm_compute/graph/frontend/Types.h index d433d1547b..78644e66af 100644 --- a/arm_compute/graph2/frontend/Types.h +++ b/arm_compute/graph/frontend/Types.h @@ -21,33 +21,33 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#ifndef __ARM_COMPUTE_GRAPH2_STREAM_TYPES_H__ -#define __ARM_COMPUTE_GRAPH2_STREAM_TYPES_H__ +#ifndef __ARM_COMPUTE_GRAPH_STREAM_TYPES_H__ +#define __ARM_COMPUTE_GRAPH_STREAM_TYPES_H__ -#include "arm_compute/graph2/Types.h" +#include "arm_compute/graph/Types.h" namespace arm_compute { -namespace graph2 +namespace graph { namespace frontend { // Import types for graph -using graph2::DataType; -using graph2::TensorShape; +using graph::DataType; +using graph::TensorShape; -using graph2::ActivationLayerInfo; -using graph2::NormalizationLayerInfo; -using graph2::NormType; -using graph2::PadStrideInfo; -using graph2::PoolingLayerInfo; -using graph2::PoolingType; -using graph2::Target; -using graph2::ConvolutionMethod; -using graph2::DepthwiseConvolutionMethod; -using graph2::TensorDescriptor; -using graph2::DimensionRoundingType; -using graph2::GraphConfig; +using graph::ActivationLayerInfo; +using graph::NormalizationLayerInfo; +using graph::NormType; +using graph::PadStrideInfo; +using graph::PoolingLayerInfo; +using graph::PoolingType; +using graph::Target; +using graph::ConvolutionMethod; +using graph::DepthwiseConvolutionMethod; +using graph::TensorDescriptor; +using graph::DimensionRoundingType; +using graph::GraphConfig; /** Branch layer merging method */ enum class BranchMergeMethod @@ -64,6 +64,6 @@ struct StreamHints DepthwiseConvolutionMethod depthwise_convolution_method_hint = { DepthwiseConvolutionMethod::DEFAULT }; /**< Depthwise Convolution method hint */ }; } // namespace frontend -} // namespace graph2 +} // namespace graph } // namespace arm_compute -#endif /* __ARM_COMPUTE_GRAPH2_STREAM_TYPES_H__ */
\ No newline at end of file +#endif /* __ARM_COMPUTE_GRAPH_STREAM_TYPES_H__ */
\ No newline at end of file diff --git a/arm_compute/graph2/mutators/DepthConcatSubTensorMutator.h b/arm_compute/graph/mutators/DepthConcatSubTensorMutator.h index bdf2e01edb..0ddd3fa5e6 100644 --- a/arm_compute/graph2/mutators/DepthConcatSubTensorMutator.h +++ b/arm_compute/graph/mutators/DepthConcatSubTensorMutator.h @@ -21,14 +21,14 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#ifndef __ARM_COMPUTE_GRAPH2_DEPTH_CONCAT_SUBTENSOR_MUTATOR_H__ -#define __ARM_COMPUTE_GRAPH2_DEPTH_CONCAT_SUBTENSOR_MUTATOR_H__ +#ifndef __ARM_COMPUTE_GRAPH_DEPTH_CONCAT_SUBTENSOR_MUTATOR_H__ +#define __ARM_COMPUTE_GRAPH_DEPTH_CONCAT_SUBTENSOR_MUTATOR_H__ -#include "arm_compute/graph2/IGraphMutator.h" +#include "arm_compute/graph/IGraphMutator.h" namespace arm_compute { -namespace graph2 +namespace graph { /** Mutation pass to optimize depth concatenation operations by using sub-tensors * @@ -41,6 +41,6 @@ public: virtual void mutate(Graph &g) override; const char *name() override; }; -} // namespace graph2 +} // namespace graph } // namespace arm_compute -#endif /* __ARM_COMPUTE_GRAPH2_DEPTH_CONCAT_SUBTENSOR_MUTATOR_H__ */ +#endif /* __ARM_COMPUTE_GRAPH_DEPTH_CONCAT_SUBTENSOR_MUTATOR_H__ */ diff --git a/arm_compute/graph2/mutators/GraphMutators.h b/arm_compute/graph/mutators/GraphMutators.h index 3275e32961..a91bc91a12 100644 --- a/arm_compute/graph2/mutators/GraphMutators.h +++ b/arm_compute/graph/mutators/GraphMutators.h @@ -21,12 +21,12 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#ifndef __ARM_COMPUTE_GRAPH2_GRAPH_MUTATORS_H__ -#define __ARM_COMPUTE_GRAPH2_GRAPH_MUTATORS_H__ +#ifndef __ARM_COMPUTE_GRAPH_GRAPH_MUTATORS_H__ +#define __ARM_COMPUTE_GRAPH_GRAPH_MUTATORS_H__ -#include "arm_compute/graph2/mutators/DepthConcatSubTensorMutator.h" -#include "arm_compute/graph2/mutators/InPlaceOperationMutator.h" -#include "arm_compute/graph2/mutators/NodeFusionMutator.h" -#include "arm_compute/graph2/mutators/SplitLayerSubTensorMutator.h" +#include "arm_compute/graph/mutators/DepthConcatSubTensorMutator.h" +#include "arm_compute/graph/mutators/InPlaceOperationMutator.h" +#include "arm_compute/graph/mutators/NodeFusionMutator.h" +#include "arm_compute/graph/mutators/SplitLayerSubTensorMutator.h" -#endif /* __ARM_COMPUTE_GRAPH2_GRAPH_MUTATORS_H__ */ +#endif /* __ARM_COMPUTE_GRAPH_GRAPH_MUTATORS_H__ */ diff --git a/arm_compute/graph2/mutators/InPlaceOperationMutator.h b/arm_compute/graph/mutators/InPlaceOperationMutator.h index 7e4018a736..69de2f10b1 100644 --- a/arm_compute/graph2/mutators/InPlaceOperationMutator.h +++ b/arm_compute/graph/mutators/InPlaceOperationMutator.h @@ -21,14 +21,14 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#ifndef __ARM_COMPUTE_GRAPH2_INPLACE_OPERATION_MUTATOR_H__ -#define __ARM_COMPUTE_GRAPH2_INPLACE_OPERATION_MUTATOR_H__ +#ifndef __ARM_COMPUTE_GRAPH_INPLACE_OPERATION_MUTATOR_H__ +#define __ARM_COMPUTE_GRAPH_INPLACE_OPERATION_MUTATOR_H__ -#include "arm_compute/graph2/IGraphMutator.h" +#include "arm_compute/graph/IGraphMutator.h" namespace arm_compute { -namespace graph2 +namespace graph { /** Mutation pass to optimize operations that can be performed in-place */ class InPlaceOperationMutator final : public IGraphMutator @@ -38,6 +38,6 @@ public: virtual void mutate(Graph &g) override; const char *name() override; }; -} // namespace graph2 +} // namespace graph } // namespace arm_compute -#endif /* __ARM_COMPUTE_GRAPH2_INPLACE_OPERATION_MUTATOR_H__ */ +#endif /* __ARM_COMPUTE_GRAPH_INPLACE_OPERATION_MUTATOR_H__ */ diff --git a/arm_compute/graph2/mutators/NodeFusionMutator.h b/arm_compute/graph/mutators/NodeFusionMutator.h index 4371bd3ebe..8f16c65dfa 100644 --- a/arm_compute/graph2/mutators/NodeFusionMutator.h +++ b/arm_compute/graph/mutators/NodeFusionMutator.h @@ -21,14 +21,14 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#ifndef __ARM_COMPUTE_GRAPH2_NODE_FUSION_MUTATOR_H__ -#define __ARM_COMPUTE_GRAPH2_NODE_FUSION_MUTATOR_H__ +#ifndef __ARM_COMPUTE_GRAPH_NODE_FUSION_MUTATOR_H__ +#define __ARM_COMPUTE_GRAPH_NODE_FUSION_MUTATOR_H__ -#include "arm_compute/graph2/IGraphMutator.h" +#include "arm_compute/graph/IGraphMutator.h" namespace arm_compute { -namespace graph2 +namespace graph { namespace detail { @@ -47,6 +47,6 @@ public: virtual void mutate(Graph &g) override; const char *name() override; }; -} // namespace graph2 +} // namespace graph } // namespace arm_compute -#endif /* __ARM_COMPUTE_GRAPH2_NODE_FUSION_MUTATOR_H__ */ +#endif /* __ARM_COMPUTE_GRAPH_NODE_FUSION_MUTATOR_H__ */ diff --git a/arm_compute/graph2/mutators/SplitLayerSubTensorMutator.h b/arm_compute/graph/mutators/SplitLayerSubTensorMutator.h index 82ee509a32..f349bb9a8c 100644 --- a/arm_compute/graph2/mutators/SplitLayerSubTensorMutator.h +++ b/arm_compute/graph/mutators/SplitLayerSubTensorMutator.h @@ -21,14 +21,14 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#ifndef __ARM_COMPUTE_GRAPH2_SPLIT_LAYER_SUBTENSOR_MUTATOR_H__ -#define __ARM_COMPUTE_GRAPH2_SPLIT_LAYER_SUBTENSOR_MUTATOR_H__ +#ifndef __ARM_COMPUTE_GRAPH_SPLIT_LAYER_SUBTENSOR_MUTATOR_H__ +#define __ARM_COMPUTE_GRAPH_SPLIT_LAYER_SUBTENSOR_MUTATOR_H__ -#include "arm_compute/graph2/IGraphMutator.h" +#include "arm_compute/graph/IGraphMutator.h" namespace arm_compute { -namespace graph2 +namespace graph { /** Mutation pass to optimize split operations by using sub-tensors * @@ -41,6 +41,6 @@ public: virtual void mutate(Graph &g) override; const char *name() override; }; -} // namespace graph2 +} // namespace graph } // namespace arm_compute -#endif /* __ARM_COMPUTE_GRAPH2_SPLIT_LAYER_SUBTENSOR_MUTATOR_H__ */ +#endif /* __ARM_COMPUTE_GRAPH_SPLIT_LAYER_SUBTENSOR_MUTATOR_H__ */ diff --git a/arm_compute/graph/nodes/ActivationLayer.h b/arm_compute/graph/nodes/ActivationLayer.h deleted file mode 100644 index bc619a8df9..0000000000 --- a/arm_compute/graph/nodes/ActivationLayer.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2017 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_ACTIVATION_LAYER_H__ -#define __ARM_COMPUTE_GRAPH_ACTIVATION_LAYER_H__ - -#include "arm_compute/graph/GraphContext.h" -#include "arm_compute/graph/INode.h" -#include "arm_compute/graph/ITensorObject.h" -#include "arm_compute/graph/Types.h" - -namespace arm_compute -{ -namespace graph -{ -/** Activation Layer node */ -class ActivationLayer final : public INode -{ -public: - /** Default Constructor - * - * @param[in] activation_info Activation layer info - */ - ActivationLayer(const ActivationLayerInfo activation_info); - - // Inherited methods overriden: - std::unique_ptr<arm_compute::IFunction> instantiate_node(GraphContext &ctx, ITensorObject *input, ITensorObject *output) override; - -private: - const ActivationLayerInfo _activation_info; /**< Activation layer info */ -}; -} // namespace graph -} // namespace arm_compute -#endif /* __ARM_COMPUTE_GRAPH_ACTIVATION_LAYER_H__ */ diff --git a/arm_compute/graph2/nodes/ActivationLayerNode.h b/arm_compute/graph/nodes/ActivationLayerNode.h index cb19c818c5..985e10a8d8 100644 --- a/arm_compute/graph2/nodes/ActivationLayerNode.h +++ b/arm_compute/graph/nodes/ActivationLayerNode.h @@ -21,14 +21,14 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#ifndef __ARM_COMPUTE_GRAPH2_ACTIVATION_LAYER_NODE_H__ -#define __ARM_COMPUTE_GRAPH2_ACTIVATION_LAYER_NODE_H__ +#ifndef __ARM_COMPUTE_GRAPH_ACTIVATION_LAYER_NODE_H__ +#define __ARM_COMPUTE_GRAPH_ACTIVATION_LAYER_NODE_H__ -#include "arm_compute/graph2/INode.h" +#include "arm_compute/graph/INode.h" namespace arm_compute { -namespace graph2 +namespace graph { /** Activation Layer node */ class ActivationLayerNode final : public INode @@ -55,6 +55,6 @@ public: private: ActivationLayerInfo _info; }; -} // namespace graph2 +} // namespace graph } // namespace arm_compute -#endif /* __ARM_COMPUTE_GRAPH2_ACTIVATION_LAYER_NODE_H__ */ +#endif /* __ARM_COMPUTE_GRAPH_ACTIVATION_LAYER_NODE_H__ */ diff --git a/arm_compute/graph/nodes/BatchNormalizationLayer.h b/arm_compute/graph/nodes/BatchNormalizationLayer.h deleted file mode 100644 index abbf09a54e..0000000000 --- a/arm_compute/graph/nodes/BatchNormalizationLayer.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2017-2018 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_BATCHNORMALIZATION_LAYER_H__ -#define __ARM_COMPUTE_GRAPH_BATCHNORMALIZATION_LAYER_H__ - -#include "arm_compute/graph/GraphContext.h" -#include "arm_compute/graph/INode.h" -#include "arm_compute/graph/ITensorObject.h" -#include "arm_compute/graph/Tensor.h" -#include "arm_compute/graph/Types.h" - -namespace arm_compute -{ -namespace graph -{ -/** BatchNormalization layer node */ -class BatchNormalizationLayer final : public INode -{ -public: - /** Default constructor - * - * @param[in] mean Mean values tensor - * @param[in] var Var values tensor - * @param[in] gamma Gamma values tensor - * @param[in] beta Beta values tensor - * @param[in] epsilon Epsilon value - * @param[in] act_info (Optional) Activation layer information in case of a fused activation. Only RELU, BOUNDED_RELU and LU_BOUNDED_RELU supported. - */ - template <typename AccessorType> - BatchNormalizationLayer(AccessorType &&mean, AccessorType &&var, AccessorType &&gamma, AccessorType &&beta, float epsilon, ActivationLayerInfo act_info = ActivationLayerInfo()) - : _mean(std::move(mean)), _var(std::move(var)), _gamma(std::move(gamma)), _beta(std::move(beta)), _epsilon(epsilon), _act_info(act_info) - { - set_supports_in_place(true); - } - - // Inherited methods overriden: - std::unique_ptr<arm_compute::IFunction> instantiate_node(GraphContext &ctx, ITensorObject *input, ITensorObject *output) override; - -private: - Tensor _mean; - Tensor _var; - Tensor _gamma; - Tensor _beta; - float _epsilon; - ActivationLayerInfo _act_info; -}; -} // namespace graph -} // namespace arm_compute -#endif /* __ARM_COMPUTE_GRAPH_BATCHNORMALIZATION_LAYER_H__ */ diff --git a/arm_compute/graph2/nodes/BatchNormalizationLayerNode.h b/arm_compute/graph/nodes/BatchNormalizationLayerNode.h index a6e8e2b98e..b36d66993b 100644 --- a/arm_compute/graph2/nodes/BatchNormalizationLayerNode.h +++ b/arm_compute/graph/nodes/BatchNormalizationLayerNode.h @@ -21,14 +21,14 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#ifndef __ARM_COMPUTE_GRAPH2_BATCH_NORMALIZATION_LAYER_NODE_H__ -#define __ARM_COMPUTE_GRAPH2_BATCH_NORMALIZATION_LAYER_NODE_H__ +#ifndef __ARM_COMPUTE_GRAPH_BATCH_NORMALIZATION_LAYER_NODE_H__ +#define __ARM_COMPUTE_GRAPH_BATCH_NORMALIZATION_LAYER_NODE_H__ -#include "arm_compute/graph2/INode.h" +#include "arm_compute/graph/INode.h" namespace arm_compute { -namespace graph2 +namespace graph { /** Batch Normalization Layer node */ class BatchNormalizationLayerNode final : public INode @@ -67,6 +67,6 @@ private: float _epsilon; ActivationLayerInfo _fused_activation; }; -} // namespace graph2 +} // namespace graph } // namespace arm_compute -#endif /* __ARM_COMPUTE_GRAPH2_BATCH_NORMALIZATION_LAYER_NODE_H__ */ +#endif /* __ARM_COMPUTE_GRAPH_BATCH_NORMALIZATION_LAYER_NODE_H__ */ diff --git a/arm_compute/graph/nodes/BranchLayer.h b/arm_compute/graph/nodes/BranchLayer.h deleted file mode 100644 index cbc016d043..0000000000 --- a/arm_compute/graph/nodes/BranchLayer.h +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2017-2018 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_BRANCH_LAYER_H__ -#define __ARM_COMPUTE_GRAPH_BRANCH_LAYER_H__ - -#include "arm_compute/graph/GraphContext.h" -#include "arm_compute/graph/INode.h" -#include "arm_compute/graph/ITensorObject.h" -#include "arm_compute/graph/SubGraph.h" -#include "arm_compute/graph/SubTensor.h" -#include "arm_compute/graph/Types.h" - -#include "arm_compute/core/utils/misc/Utility.h" - -#include <vector> - -namespace arm_compute -{ -namespace graph -{ -/** Branch Layer node */ -class BranchLayer final : public INode -{ -public: - /** Default Constructor - * - * @param[in] merge_method Branch merging method - * @param[in] sub_graph1 First graph branch - * @param[in] sub_graph2 Second graph branch - * @param[in] rest_sub_graphs Rest sub-graph branches - */ - template <typename... Ts> - BranchLayer(BranchMergeMethod merge_method, SubGraph &&sub_graph1, SubGraph &&sub_graph2, Ts &&... rest_sub_graphs) - : _branch_merge_method(merge_method), _sub_graphs() - { - /* TODO:(geopin01) Use traits to make sure variadic arguments are of SubGraph type */ - _sub_graphs.push_back(arm_compute::support::cpp14::make_unique<SubGraph>(std::move(sub_graph1))); - _sub_graphs.push_back(arm_compute::support::cpp14::make_unique<SubGraph>(std::move(sub_graph2))); - - utility::for_each([&](SubGraph && sub_graph) - { - _sub_graphs.push_back(arm_compute::support::cpp14::make_unique<SubGraph>(std::move(sub_graph))); - }, - std::move(rest_sub_graphs)...); - } - /** Default Constructor - * - * @param[in] sub_graph Sub graph - */ - template <typename... Ts> - BranchLayer(SubGraph &&sub_graph) - : _branch_merge_method(BranchMergeMethod::DEPTH_CONCATENATE), _sub_graphs() - { - /* TODO:(geopin01) Use traits to make sure variadic arguments are of SubGraph type */ - _sub_graphs.push_back(arm_compute::support::cpp14::make_unique<SubGraph>(std::move(sub_graph))); - } - - // Inherited methods overriden: - std::unique_ptr<arm_compute::IFunction> instantiate_node(GraphContext &ctx, ITensorObject *input, ITensorObject *output) override; - -private: - BranchMergeMethod _branch_merge_method; - std::vector<std::unique_ptr<SubGraph>> _sub_graphs; -}; -} // namespace graph -} // namespace arm_compute -#endif /* __ARM_COMPUTE_GRAPH_BRANCH_LAYER_H__ */ diff --git a/arm_compute/graph2/nodes/ConstNode.h b/arm_compute/graph/nodes/ConstNode.h index e1c66176f0..346a3c82e7 100644 --- a/arm_compute/graph2/nodes/ConstNode.h +++ b/arm_compute/graph/nodes/ConstNode.h @@ -21,14 +21,14 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#ifndef __ARM_COMPUTE_GRAPH2_CONST_NODE_H__ -#define __ARM_COMPUTE_GRAPH2_CONST_NODE_H__ +#ifndef __ARM_COMPUTE_GRAPH_CONST_NODE_H__ +#define __ARM_COMPUTE_GRAPH_CONST_NODE_H__ -#include "arm_compute/graph2/INode.h" +#include "arm_compute/graph/INode.h" namespace arm_compute { -namespace graph2 +namespace graph { /** Const node */ class ConstNode final : public INode @@ -50,6 +50,6 @@ public: private: TensorDescriptor _desc; }; -} // namespace graph2 +} // namespace graph } // namespace arm_compute -#endif /* __ARM_COMPUTE_GRAPH2_CONST_NODE_H__ */ +#endif /* __ARM_COMPUTE_GRAPH_CONST_NODE_H__ */ diff --git a/arm_compute/graph/nodes/ConvolutionLayer.h b/arm_compute/graph/nodes/ConvolutionLayer.h deleted file mode 100644 index 1806190971..0000000000 --- a/arm_compute/graph/nodes/ConvolutionLayer.h +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Copyright (c) 2017-2018 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_CONVOLUTION_LAYER_H__ -#define __ARM_COMPUTE_GRAPH_CONVOLUTION_LAYER_H__ - -#include "arm_compute/graph/GraphContext.h" -#include "arm_compute/graph/INode.h" -#include "arm_compute/graph/ITensorObject.h" -#include "arm_compute/graph/SubTensor.h" -#include "arm_compute/graph/Tensor.h" -#include "arm_compute/graph/Types.h" -#include "arm_compute/runtime/IFunction.h" - -#include <memory> - -namespace arm_compute -{ -namespace graph -{ -/** Convolution layer node */ -class ConvolutionLayer final : public INode -{ -public: - /** Default Constructor - * - * @param[in] conv_width Convolution width - * @param[in] conv_height Convolution height - * @param[in] ofm Output feature map - * @param[in] weights Weights of the convolution layer - * @param[in] biases Bias of the convolution layer - * @param[in] conv_info Convolution information - * @param[in] num_groups (Optional) Number of groups, default = 1 - * @param[in] weights_info (Optional) Weights information - * @param[in] weights_quant_info (Optional) Weights quantization information - * @param[in] out_quant_info (Optional) Output quantization info - */ - template <typename AccessorTypeWeights, typename AccessorTypeBiases> - ConvolutionLayer(unsigned int conv_width, - unsigned int conv_height, - unsigned int ofm, - AccessorTypeWeights &&weights, - AccessorTypeBiases &&biases, - const PadStrideInfo conv_info, - unsigned int num_groups = 1, - const WeightsInfo weights_info = WeightsInfo(), - const QuantizationInfo weights_quant_info = QuantizationInfo(), - const QuantizationInfo out_quant_info = QuantizationInfo()) - : _conv_width(conv_width), - _conv_height(conv_height), - _ofm(ofm), - _weights(std::move(weights)), - _biases(std::move(biases)), - _conv_info(std::move(conv_info)), - _num_groups(num_groups), - _weights_info(std::move(weights_info)), - _weights_quant_info(std::move(weights_quant_info)), - _out_quant_info(std::move(out_quant_info)), - _is(nullptr), - _os(nullptr), - _ws(nullptr), - _bs(nullptr) - { - } - - // Inherited methods overriden: - std::unique_ptr<arm_compute::IFunction> instantiate_node(GraphContext &ctx, ITensorObject *input, ITensorObject *output) override; - -private: - /** Instantiates a non-grouped convolution - * - * @param[in] input Input tensor - * @param[in] output Output tensor - * @param[in] conv_method_hint Hint that specifies which convolution layer method to use - * - * @return Convolution function - */ - std::unique_ptr<arm_compute::IFunction> instantiate_convolution(ITensor *input, ITensor *output, ConvolutionMethodHint conv_method_hint); - /** Instantiates a grouped convolution - * - * @param[in] input Input tensor - * @param[in] output Output tensor - * @param[in] conv_method_hint Hint that specifies which convolution layer method to use - * - * @return Grouped Convolution function - */ - std::unique_ptr<arm_compute::IFunction> instantiate_grouped_convolution(ITensor *input, ITensor *output, ConvolutionMethodHint conv_method_hint); - -private: - unsigned int _conv_width; /**< Convolution width */ - unsigned int _conv_height; /**< Convolution height */ - unsigned int _ofm; /**< Output feature maps */ - Tensor _weights; /**< Weights tensor */ - Tensor _biases; /**< Biases tensor */ - const PadStrideInfo _conv_info; /**< Convolution layer information */ - unsigned int _num_groups; /**< Number of groups */ - const WeightsInfo _weights_info; /**< Convolution layer weights information */ - const QuantizationInfo _weights_quant_info; /**< Output quantization information */ - const QuantizationInfo _out_quant_info; /**< Output quantization information */ - - std::unique_ptr<SubTensor[]> _is; /**< Input tensor sub-tensors used for grouped convolution */ - std::unique_ptr<SubTensor[]> _os; /**< Output tensor sub-tensors used for grouped convolution */ - std::unique_ptr<SubTensor[]> _ws; /**< Weights tensor sub-tensors used for grouped convolution */ - std::unique_ptr<SubTensor[]> _bs; /**< Biases tensor sub-tensors used for grouped convolution */ -}; -} // namespace graph -} // namespace arm_compute -#endif /* __ARM_COMPUTE_GRAPH_CONVOLUTION_LAYER_H__ */ diff --git a/arm_compute/graph2/nodes/ConvolutionLayerNode.h b/arm_compute/graph/nodes/ConvolutionLayerNode.h index 6e3c9bef32..70fefbeeab 100644 --- a/arm_compute/graph2/nodes/ConvolutionLayerNode.h +++ b/arm_compute/graph/nodes/ConvolutionLayerNode.h @@ -21,14 +21,14 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#ifndef __ARM_COMPUTE_GRAPH2_CONVOLUTION_LAYER_NODE_H__ -#define __ARM_COMPUTE_GRAPH2_CONVOLUTION_LAYER_NODE_H__ +#ifndef __ARM_COMPUTE_GRAPH_CONVOLUTION_LAYER_NODE_H__ +#define __ARM_COMPUTE_GRAPH_CONVOLUTION_LAYER_NODE_H__ -#include "arm_compute/graph2/INode.h" +#include "arm_compute/graph/INode.h" namespace arm_compute { -namespace graph2 +namespace graph { /** Convolution Layer node */ class ConvolutionLayerNode final : public INode @@ -79,6 +79,6 @@ private: PadStrideInfo _info; ConvolutionMethod _method; }; -} // namespace graph2 +} // namespace graph } // namespace arm_compute -#endif /* __ARM_COMPUTE_GRAPH2_CONVOLUTION_LAYER_NODE_H__ */ +#endif /* __ARM_COMPUTE_GRAPH_CONVOLUTION_LAYER_NODE_H__ */ diff --git a/arm_compute/graph2/nodes/DepthConcatenateLayerNode.h b/arm_compute/graph/nodes/DepthConcatenateLayerNode.h index 23c31048e9..cb309f38c1 100644 --- a/arm_compute/graph2/nodes/DepthConcatenateLayerNode.h +++ b/arm_compute/graph/nodes/DepthConcatenateLayerNode.h @@ -21,14 +21,14 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#ifndef __ARM_COMPUTE_GRAPH2_DEPTH_CONCATENATE_LAYER_NODE_H__ -#define __ARM_COMPUTE_GRAPH2_DEPTH_CONCATENATE_LAYER_NODE_H__ +#ifndef __ARM_COMPUTE_GRAPH_DEPTH_CONCATENATE_LAYER_NODE_H__ +#define __ARM_COMPUTE_GRAPH_DEPTH_CONCATENATE_LAYER_NODE_H__ -#include "arm_compute/graph2/INode.h" +#include "arm_compute/graph/INode.h" namespace arm_compute { -namespace graph2 +namespace graph { /** Depth Concatenation Layer node */ class DepthConcatenateLayerNode final : public INode @@ -73,6 +73,6 @@ private: unsigned int _total_nodes; bool _is_enabled; }; -} // namespace graph2 +} // namespace graph } // namespace arm_compute -#endif /* __ARM_COMPUTE_GRAPH2_DEPTH_CONCATENATE_LAYER_NODE_H__ */ +#endif /* __ARM_COMPUTE_GRAPH_DEPTH_CONCATENATE_LAYER_NODE_H__ */ diff --git a/arm_compute/graph/nodes/DepthConvertLayer.h b/arm_compute/graph/nodes/DepthConvertLayer.h deleted file mode 100644 index 03bf9b7ed5..0000000000 --- a/arm_compute/graph/nodes/DepthConvertLayer.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2017 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_DEPTHCONVERT_LAYER_H__ -#define __ARM_COMPUTE_GRAPH_DEPTHCONVERT_LAYER_H__ - -#include "arm_compute/graph/GraphContext.h" -#include "arm_compute/graph/INode.h" -#include "arm_compute/graph/ITensorObject.h" -#include "arm_compute/graph/Types.h" - -namespace arm_compute -{ -namespace graph -{ -/** DepthConvertLayer layer node */ -class DepthConvertLayer final : public INode -{ -public: - /** Default constructor - * - * @param[in] policy Convertion policy - * @param[in] shift Shift value - * @param[in] output_datatype Output datatype - */ - DepthConvertLayer(const ConvertPolicy policy, uint32_t shift, DataType output_datatype); - - // Inherited methods overriden: - std::unique_ptr<arm_compute::IFunction> instantiate_node(GraphContext &ctx, ITensorObject *input, ITensorObject *output) override; - -private: - const ConvertPolicy _policy; - uint32_t _shift; - DataType _output_datatype; -}; -} // namespace graph -} // namespace arm_compute -#endif /* __ARM_COMPUTE_GRAPH_DEPTHCONVERT_LAYER_H__ */ diff --git a/arm_compute/graph/nodes/DepthwiseConvolutionLayer.h b/arm_compute/graph/nodes/DepthwiseConvolutionLayer.h deleted file mode 100644 index 2d4bd1e0c2..0000000000 --- a/arm_compute/graph/nodes/DepthwiseConvolutionLayer.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2017-2018 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_DEPTHWISE_CONVOLUTION_LAYER_H__ -#define __ARM_COMPUTE_GRAPH_DEPTHWISE_CONVOLUTION_LAYER_H__ - -#include "arm_compute/graph/GraphContext.h" -#include "arm_compute/graph/INode.h" -#include "arm_compute/graph/ITensorObject.h" -#include "arm_compute/graph/SubTensor.h" -#include "arm_compute/graph/Tensor.h" -#include "arm_compute/graph/Types.h" -#include "arm_compute/runtime/IFunction.h" - -#include <memory> - -namespace arm_compute -{ -namespace graph -{ -/** Convolution layer node */ -class DepthwiseConvolutionLayer final : public INode -{ -public: - /** Default constructor - * - * @param[in] conv_width Convolution width - * @param[in] conv_height Convolution height - * @param[in] weights Weights values tensor - * @param[in] biases Biases values tensor - * @param[in] conv_info Convolution info - * @param[in] opt3x3 (Optional) If true executes DepthwiseConvolutionLayer3x3 - * @param[in] quant_info (Optional) Quantization info used for weights - */ - template <typename AccessorType> - DepthwiseConvolutionLayer(unsigned int conv_width, unsigned int conv_height, AccessorType &&weights, AccessorType &&biases, const PadStrideInfo conv_info, bool opt3x3 = true, - const QuantizationInfo quant_info = QuantizationInfo()) - : _conv_width(conv_width), _conv_height(conv_height), _weights(std::move(weights)), _biases(std::move(biases)), _conv_info(conv_info), _opt3x3(opt3x3), _quant_info(std::move(quant_info)) - { - } - - // Inherited methods overriden: - std::unique_ptr<arm_compute::IFunction> instantiate_node(GraphContext &ctx, ITensorObject *input, ITensorObject *output) override; - -private: - unsigned int _conv_width; - unsigned int _conv_height; - Tensor _weights; - Tensor _biases; - const PadStrideInfo _conv_info; - bool _opt3x3; - const QuantizationInfo _quant_info; -}; -} // namespace graph -} // namespace arm_compute -#endif /* __ARM_COMPUTE_GRAPH_DEPTHWISE_CONVOLUTION_LAYER_H__ */ diff --git a/arm_compute/graph2/nodes/DepthwiseConvolutionLayerNode.h b/arm_compute/graph/nodes/DepthwiseConvolutionLayerNode.h index d5b8e34554..b4cf9b4d03 100644 --- a/arm_compute/graph2/nodes/DepthwiseConvolutionLayerNode.h +++ b/arm_compute/graph/nodes/DepthwiseConvolutionLayerNode.h @@ -21,14 +21,14 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#ifndef __ARM_COMPUTE_GRAPH2_DEPTHWISE_CONVOLUTION_LAYER_NODE_H__ -#define __ARM_COMPUTE_GRAPH2_DEPTHWISE_CONVOLUTION_LAYER_NODE_H__ +#ifndef __ARM_COMPUTE_GRAPH_DEPTHWISE_CONVOLUTION_LAYER_NODE_H__ +#define __ARM_COMPUTE_GRAPH_DEPTHWISE_CONVOLUTION_LAYER_NODE_H__ -#include "arm_compute/graph2/INode.h" +#include "arm_compute/graph/INode.h" namespace arm_compute { -namespace graph2 +namespace graph { /** Depthwise Convolution Layer node */ class DepthwiseConvolutionLayerNode final : public INode @@ -79,6 +79,6 @@ private: PadStrideInfo _info; DepthwiseConvolutionMethod _method; }; -} // namespace graph2 +} // namespace graph } // namespace arm_compute -#endif /* __ARM_COMPUTE_GRAPH2_DEPTHWISE_CONVOLUTION_LAYER_NODE_H__ */ +#endif /* __ARM_COMPUTE_GRAPH_DEPTHWISE_CONVOLUTION_LAYER_NODE_H__ */ diff --git a/arm_compute/graph2/nodes/EltwiseLayerNode.h b/arm_compute/graph/nodes/EltwiseLayerNode.h index 48df2b715d..9da88d75b5 100644 --- a/arm_compute/graph2/nodes/EltwiseLayerNode.h +++ b/arm_compute/graph/nodes/EltwiseLayerNode.h @@ -21,14 +21,14 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#ifndef __ARM_COMPUTE_GRAPH2_ELTWISE_LAYER_NODE_H__ -#define __ARM_COMPUTE_GRAPH2_ELTWISE_LAYER_NODE_H__ +#ifndef __ARM_COMPUTE_GRAPH_ELTWISE_LAYER_NODE_H__ +#define __ARM_COMPUTE_GRAPH_ELTWISE_LAYER_NODE_H__ -#include "arm_compute/graph2/INode.h" +#include "arm_compute/graph/INode.h" namespace arm_compute { -namespace graph2 +namespace graph { /** Eltwise Layer node */ class EltwiseLayerNode final : public INode @@ -55,6 +55,6 @@ public: private: EltwiseOperation _op; }; -} // namespace graph2 +} // namespace graph } // namespace arm_compute -#endif /* __ARM_COMPUTE_GRAPH2_ELTWISE_LAYER_NODE_H__ */ +#endif /* __ARM_COMPUTE_GRAPH_ELTWISE_LAYER_NODE_H__ */ diff --git a/arm_compute/graph/nodes/FlattenLayer.h b/arm_compute/graph/nodes/FlattenLayer.h deleted file mode 100644 index c5f51a2b3e..0000000000 --- a/arm_compute/graph/nodes/FlattenLayer.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2017 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_FLATTEN_LAYER_H__ -#define __ARM_COMPUTE_GRAPH_FLATTEN_LAYER_H__ - -#include "arm_compute/graph/GraphContext.h" -#include "arm_compute/graph/INode.h" -#include "arm_compute/graph/ITensorObject.h" -#include "arm_compute/graph/Types.h" - -namespace arm_compute -{ -namespace graph -{ -/** Flatten layer node */ -class FlattenLayer final : public INode -{ -public: - // Inherited methods overriden: - std::unique_ptr<arm_compute::IFunction> instantiate_node(GraphContext &ctx, ITensorObject *input, ITensorObject *output) override; -}; -} // namespace graph -} // namespace arm_compute -#endif /* __ARM_COMPUTE_GRAPH_FLATTEN_LAYER_H__ */ diff --git a/arm_compute/graph2/nodes/FlattenLayerNode.h b/arm_compute/graph/nodes/FlattenLayerNode.h index 41f6f85045..f0dde1fab1 100644 --- a/arm_compute/graph2/nodes/FlattenLayerNode.h +++ b/arm_compute/graph/nodes/FlattenLayerNode.h @@ -21,14 +21,14 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#ifndef __ARM_COMPUTE_GRAPH2_FLATTEN_LAYER_NODE_H__ -#define __ARM_COMPUTE_GRAPH2_FLATTEN_LAYER_NODE_H__ +#ifndef __ARM_COMPUTE_GRAPH_FLATTEN_LAYER_NODE_H__ +#define __ARM_COMPUTE_GRAPH_FLATTEN_LAYER_NODE_H__ -#include "arm_compute/graph2/INode.h" +#include "arm_compute/graph/INode.h" namespace arm_compute { -namespace graph2 +namespace graph { /** Flatten Layer node */ class FlattenLayerNode final : public INode @@ -44,6 +44,6 @@ public: TensorDescriptor configure_output(size_t idx) const override; void accept(INodeVisitor &v) override; }; -} // namespace graph2 +} // namespace graph } // namespace arm_compute -#endif /* __ARM_COMPUTE_GRAPH2_FLATTEN_LAYER_NODE_H__ */ +#endif /* __ARM_COMPUTE_GRAPH_FLATTEN_LAYER_NODE_H__ */ diff --git a/arm_compute/graph/nodes/FloorLayer.h b/arm_compute/graph/nodes/FloorLayer.h deleted file mode 100644 index 146e2c16dd..0000000000 --- a/arm_compute/graph/nodes/FloorLayer.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2017 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_FLOOR_LAYER_H__ -#define __ARM_COMPUTE_GRAPH_FLOOR_LAYER_H__ - -#include "arm_compute/graph/GraphContext.h" -#include "arm_compute/graph/INode.h" -#include "arm_compute/graph/ITensorObject.h" -#include "arm_compute/graph/Types.h" -namespace arm_compute -{ -namespace graph -{ -/** Floor layer node */ -class FloorLayer final : public INode -{ -public: - // Inherited methods overriden: - std::unique_ptr<arm_compute::IFunction> instantiate_node(GraphContext &ctx, ITensorObject *input, ITensorObject *output) override; -}; - -} // namespace graph -} // namespace arm_compute -#endif /* __ARM_COMPUTE_GRAPH_FLOOR_LAYER_H__ */ diff --git a/arm_compute/graph/nodes/FullyConnectedLayer.h b/arm_compute/graph/nodes/FullyConnectedLayer.h deleted file mode 100644 index 270676a6b5..0000000000 --- a/arm_compute/graph/nodes/FullyConnectedLayer.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2017 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_FULLY_CONNECTED_LAYER_H__ -#define __ARM_COMPUTE_GRAPH_FULLY_CONNECTED_LAYER_H__ - -#include "arm_compute/graph/GraphContext.h" -#include "arm_compute/graph/INode.h" -#include "arm_compute/graph/ITensorObject.h" -#include "arm_compute/graph/Tensor.h" -#include "arm_compute/graph/Types.h" - -namespace arm_compute -{ -namespace graph -{ -/** Fully connected layer node */ -class FullyConnectedLayer final : public INode -{ -public: - /** Default constructor - * - * @param[in] num_neurons Number of neurons - * @param[in] weights Weights of the fully connected layer - * @param[in] biases Biases of the fully connected layer - */ - template <typename AccessorTypeWeights, typename AccessorTypeBiases> - FullyConnectedLayer(unsigned int num_neurons, AccessorTypeWeights &&weights, AccessorTypeBiases &&biases) - : _num_neurons(num_neurons), _weights(std::move(weights)), _biases(std::move(biases)) - { - } - - // Inherited methods overriden: - std::unique_ptr<arm_compute::IFunction> instantiate_node(GraphContext &ctx, ITensorObject *input, ITensorObject *output) override; - - // Inherited methods overriden: -private: - unsigned int _num_neurons; /**< Number of neurons */ - Tensor _weights; /**< Weights tensor */ - Tensor _biases; /**< Biases tensor */ -}; -} // namespace graph -} // namespace arm_compute -#endif /* __ARM_COMPUTE_GRAPH_FULLY_CONNECTED_LAYER_H__ */ diff --git a/arm_compute/graph2/nodes/FullyConnectedLayerNode.h b/arm_compute/graph/nodes/FullyConnectedLayerNode.h index 5c71f4ca69..166751b8fa 100644 --- a/arm_compute/graph2/nodes/FullyConnectedLayerNode.h +++ b/arm_compute/graph/nodes/FullyConnectedLayerNode.h @@ -21,14 +21,14 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#ifndef __ARM_COMPUTE_GRAPH2_FULLY_CONNECTED_LAYER_NODE_H__ -#define __ARM_COMPUTE_GRAPH2_FULLY_CONNECTED_LAYER_NODE_H__ +#ifndef __ARM_COMPUTE_GRAPH_FULLY_CONNECTED_LAYER_NODE_H__ +#define __ARM_COMPUTE_GRAPH_FULLY_CONNECTED_LAYER_NODE_H__ -#include "arm_compute/graph2/INode.h" +#include "arm_compute/graph/INode.h" namespace arm_compute { -namespace graph2 +namespace graph { /** Fully Connected Layer node */ class FullyConnectedLayerNode final : public INode @@ -70,6 +70,6 @@ public: private: unsigned int _num_outputs; }; -} // namespace graph2 +} // namespace graph } // namespace arm_compute -#endif /* __ARM_COMPUTE_GRAPH2_FULLY_CONNECTED_LAYER_NODE_H__ */ +#endif /* __ARM_COMPUTE_GRAPH_FULLY_CONNECTED_LAYER_NODE_H__ */ diff --git a/arm_compute/graph2/nodes/InputNode.h b/arm_compute/graph/nodes/InputNode.h index 667dcfacf0..cacea95ab8 100644 --- a/arm_compute/graph2/nodes/InputNode.h +++ b/arm_compute/graph/nodes/InputNode.h @@ -21,14 +21,14 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#ifndef __ARM_COMPUTE_GRAPH2_INPUT_NODE_H__ -#define __ARM_COMPUTE_GRAPH2_INPUT_NODE_H__ +#ifndef __ARM_COMPUTE_GRAPH_INPUT_NODE_H__ +#define __ARM_COMPUTE_GRAPH_INPUT_NODE_H__ -#include "arm_compute/graph2/INode.h" +#include "arm_compute/graph/INode.h" namespace arm_compute { -namespace graph2 +namespace graph { /** Input Layer node */ class InputNode final : public INode @@ -50,6 +50,6 @@ public: private: TensorDescriptor _desc; }; -} // namespace graph2 +} // namespace graph } // namespace arm_compute -#endif /* __ARM_COMPUTE_GRAPH2_INPUT_NODE_H__ */ +#endif /* __ARM_COMPUTE_GRAPH_INPUT_NODE_H__ */ diff --git a/arm_compute/graph/nodes/L2NormalizeLayer.h b/arm_compute/graph/nodes/L2NormalizeLayer.h deleted file mode 100644 index a423306bd2..0000000000 --- a/arm_compute/graph/nodes/L2NormalizeLayer.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2017 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_L2NORMALIZE_LAYER_H__ -#define __ARM_COMPUTE_GRAPH_L2NORMALIZE_LAYER_H__ - -#include "arm_compute/graph/GraphContext.h" -#include "arm_compute/graph/INode.h" -#include "arm_compute/graph/ITensorObject.h" -#include "arm_compute/graph/Types.h" - -namespace arm_compute -{ -namespace graph -{ -/** L2NormalizeLayer layer node */ -class L2NormalizeLayer final : public INode -{ -public: - /** Default Constructor - * - * @param[in] axis Dimension along which to reduce. - * @param[in] epsilon Lower bound value for the normalization. - */ - explicit L2NormalizeLayer(unsigned int axis, float epsilon); - - // Inherited methods overriden: - std::unique_ptr<arm_compute::IFunction> instantiate_node(GraphContext &ctx, ITensorObject *input, ITensorObject *output) override; - -private: - unsigned int _axis; - float _epsilon; -}; -} // namespace graph -} // namespace arm_compute -#endif /* __ARM_COMPUTE_GRAPH_L2NORMALIZE_LAYER_H__ */ diff --git a/arm_compute/graph/Nodes.h b/arm_compute/graph/nodes/Nodes.h index 3009a24fcb..c39546c6bd 100644 --- a/arm_compute/graph/Nodes.h +++ b/arm_compute/graph/nodes/Nodes.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018 ARM Limited. + * Copyright (c) 2018 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -24,22 +24,21 @@ #ifndef __ARM_COMPUTE_GRAPH_NODES_H__ #define __ARM_COMPUTE_GRAPH_NODES_H__ -#include "arm_compute/graph/nodes/ActivationLayer.h" -#include "arm_compute/graph/nodes/BatchNormalizationLayer.h" -#include "arm_compute/graph/nodes/BranchLayer.h" -#include "arm_compute/graph/nodes/ConvolutionLayer.h" -#include "arm_compute/graph/nodes/DepthConvertLayer.h" -#include "arm_compute/graph/nodes/DepthwiseConvolutionLayer.h" -#include "arm_compute/graph/nodes/DequantizationLayer.h" -#include "arm_compute/graph/nodes/FlattenLayer.h" -#include "arm_compute/graph/nodes/FloorLayer.h" -#include "arm_compute/graph/nodes/FullyConnectedLayer.h" -#include "arm_compute/graph/nodes/L2NormalizeLayer.h" -#include "arm_compute/graph/nodes/NormalizationLayer.h" -#include "arm_compute/graph/nodes/PoolingLayer.h" -#include "arm_compute/graph/nodes/QuantizationLayer.h" -#include "arm_compute/graph/nodes/ReshapeLayer.h" -#include "arm_compute/graph/nodes/ResidualLayer.h" -#include "arm_compute/graph/nodes/SoftmaxLayer.h" +#include "arm_compute/graph/nodes/ActivationLayerNode.h" +#include "arm_compute/graph/nodes/BatchNormalizationLayerNode.h" +#include "arm_compute/graph/nodes/ConstNode.h" +#include "arm_compute/graph/nodes/ConvolutionLayerNode.h" +#include "arm_compute/graph/nodes/DepthConcatenateLayerNode.h" +#include "arm_compute/graph/nodes/DepthwiseConvolutionLayerNode.h" +#include "arm_compute/graph/nodes/EltwiseLayerNode.h" +#include "arm_compute/graph/nodes/FlattenLayerNode.h" +#include "arm_compute/graph/nodes/FullyConnectedLayerNode.h" +#include "arm_compute/graph/nodes/InputNode.h" +#include "arm_compute/graph/nodes/NormalizationLayerNode.h" +#include "arm_compute/graph/nodes/OutputNode.h" +#include "arm_compute/graph/nodes/PoolingLayerNode.h" +#include "arm_compute/graph/nodes/ReshapeLayerNode.h" +#include "arm_compute/graph/nodes/SoftmaxLayerNode.h" +#include "arm_compute/graph/nodes/SplitLayerNode.h" #endif /* __ARM_COMPUTE_GRAPH_NODES_H__ */ diff --git a/arm_compute/graph2/nodes/NodesFwd.h b/arm_compute/graph/nodes/NodesFwd.h index 08f2454cde..b90cb5c308 100644 --- a/arm_compute/graph2/nodes/NodesFwd.h +++ b/arm_compute/graph/nodes/NodesFwd.h @@ -21,12 +21,12 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#ifndef __ARM_COMPUTE_GRAPH2_NODES_FWD_H__ -#define __ARM_COMPUTE_GRAPH2_NODES_FWD_H__ +#ifndef __ARM_COMPUTE_GRAPH_NODES_FWD_H__ +#define __ARM_COMPUTE_GRAPH_NODES_FWD_H__ namespace arm_compute { -namespace graph2 +namespace graph { // Forward declarations class INode; @@ -46,6 +46,6 @@ class PoolingLayerNode; class ReshapeLayerNode; class SoftmaxLayerNode; class SplitLayerNode; -} // namespace graph2 +} // namespace graph } // namespace arm_compute -#endif /* __ARM_COMPUTE_GRAPH2_NODES_FWD_H__ */ +#endif /* __ARM_COMPUTE_GRAPH_NODES_FWD_H__ */ diff --git a/arm_compute/graph/nodes/NormalizationLayer.h b/arm_compute/graph/nodes/NormalizationLayer.h deleted file mode 100644 index e1c45094d8..0000000000 --- a/arm_compute/graph/nodes/NormalizationLayer.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2017 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_NORMALIZATION_LAYER_H__ -#define __ARM_COMPUTE_GRAPH_NORMALIZATION_LAYER_H__ - -#include "arm_compute/graph/GraphContext.h" -#include "arm_compute/graph/INode.h" -#include "arm_compute/graph/ITensorObject.h" -#include "arm_compute/graph/Types.h" - -namespace arm_compute -{ -namespace graph -{ -/** Normalization layer node */ -class NormalizationLayer final : public INode -{ -public: - /** Default Constructor - * - * @param[in] norm_info Normalization layer information - */ - explicit NormalizationLayer(const NormalizationLayerInfo norm_info); - - // Inherited methods overriden: - std::unique_ptr<arm_compute::IFunction> instantiate_node(GraphContext &ctx, ITensorObject *input, ITensorObject *output) override; - -private: - const NormalizationLayerInfo _norm_info; /**< Normalization layer information */ -}; -} // namespace graph -} // namespace arm_compute -#endif /* __ARM_COMPUTE_GRAPH_NORMALIZATION_LAYER_H__ */ diff --git a/arm_compute/graph2/nodes/NormalizationLayerNode.h b/arm_compute/graph/nodes/NormalizationLayerNode.h index 78a843a1e7..34dc3ccf8f 100644 --- a/arm_compute/graph2/nodes/NormalizationLayerNode.h +++ b/arm_compute/graph/nodes/NormalizationLayerNode.h @@ -21,14 +21,14 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#ifndef __ARM_COMPUTE_GRAPH2_NORMALIZATION_LAYER_NODE_H__ -#define __ARM_COMPUTE_GRAPH2_NORMALIZATION_LAYER_NODE_H__ +#ifndef __ARM_COMPUTE_GRAPH_NORMALIZATION_LAYER_NODE_H__ +#define __ARM_COMPUTE_GRAPH_NORMALIZATION_LAYER_NODE_H__ -#include "arm_compute/graph2/INode.h" +#include "arm_compute/graph/INode.h" namespace arm_compute { -namespace graph2 +namespace graph { /** Normalization Layer node */ class NormalizationLayerNode final : public INode @@ -55,6 +55,6 @@ public: private: NormalizationLayerInfo _info; }; -} // namespace graph2 +} // namespace graph } // namespace arm_compute -#endif /* __ARM_COMPUTE_GRAPH2_NORMALIZATION_LAYER_NODE_H__ */ +#endif /* __ARM_COMPUTE_GRAPH_NORMALIZATION_LAYER_NODE_H__ */ diff --git a/arm_compute/graph2/nodes/OutputNode.h b/arm_compute/graph/nodes/OutputNode.h index 0c28c84214..46988cf969 100644 --- a/arm_compute/graph2/nodes/OutputNode.h +++ b/arm_compute/graph/nodes/OutputNode.h @@ -21,14 +21,14 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#ifndef __ARM_COMPUTE_GRAPH2_OUTPUT_NODE_H__ -#define __ARM_COMPUTE_GRAPH2_OUTPUT_NODE_H__ +#ifndef __ARM_COMPUTE_GRAPH_OUTPUT_NODE_H__ +#define __ARM_COMPUTE_GRAPH_OUTPUT_NODE_H__ -#include "arm_compute/graph2/INode.h" +#include "arm_compute/graph/INode.h" namespace arm_compute { -namespace graph2 +namespace graph { /** Output Layer node */ class OutputNode final : public INode @@ -44,6 +44,6 @@ public: TensorDescriptor configure_output(size_t idx) const override; void accept(INodeVisitor &v) override; }; -} // namespace graph2 +} // namespace graph } // namespace arm_compute -#endif /* __ARM_COMPUTE_GRAPH2_OUTPUT_NODE_H__ */ +#endif /* __ARM_COMPUTE_GRAPH_OUTPUT_NODE_H__ */ diff --git a/arm_compute/graph/nodes/PoolingLayer.h b/arm_compute/graph/nodes/PoolingLayer.h deleted file mode 100644 index 5c45bc04ed..0000000000 --- a/arm_compute/graph/nodes/PoolingLayer.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2017 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_POOLING_LAYER_H__ -#define __ARM_COMPUTE_GRAPH_POOLING_LAYER_H__ - -#include "arm_compute/graph/GraphContext.h" -#include "arm_compute/graph/INode.h" -#include "arm_compute/graph/ITensorObject.h" -#include "arm_compute/graph/Types.h" - -namespace arm_compute -{ -namespace graph -{ -/** Pooling layer node */ -class PoolingLayer final : public INode -{ -public: - /** Default Constructor - * - * @param pool_info Pooling layer information - */ - PoolingLayer(const PoolingLayerInfo pool_info); - - // Inherited methods overriden: - std::unique_ptr<arm_compute::IFunction> instantiate_node(GraphContext &ctx, ITensorObject *input, ITensorObject *output) override; - -private: - const PoolingLayerInfo _pool_info; /**< Pooling layer information */ -}; -} // namespace graph -} // namespace arm_compute -#endif /* __ARM_COMPUTE_GRAPH_POOLING_LAYER_H__ */ diff --git a/arm_compute/graph2/nodes/PoolingLayerNode.h b/arm_compute/graph/nodes/PoolingLayerNode.h index 09332a9367..e250eb247a 100644 --- a/arm_compute/graph2/nodes/PoolingLayerNode.h +++ b/arm_compute/graph/nodes/PoolingLayerNode.h @@ -21,14 +21,14 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#ifndef __ARM_COMPUTE_GRAPH2_POOLING_LAYER_NODE_H__ -#define __ARM_COMPUTE_GRAPH2_POOLING_LAYER_NODE_H__ +#ifndef __ARM_COMPUTE_GRAPH_POOLING_LAYER_NODE_H__ +#define __ARM_COMPUTE_GRAPH_POOLING_LAYER_NODE_H__ -#include "arm_compute/graph2/INode.h" +#include "arm_compute/graph/INode.h" namespace arm_compute { -namespace graph2 +namespace graph { /** Pooling Layer node */ class PoolingLayerNode final : public INode @@ -63,6 +63,6 @@ public: private: PoolingLayerInfo _info; }; -} // namespace graph2 +} // namespace graph } // namespace arm_compute -#endif /* __ARM_COMPUTE_GRAPH2_POOLING_LAYER_NODE_H__ */ +#endif /* __ARM_COMPUTE_GRAPH_POOLING_LAYER_NODE_H__ */ diff --git a/arm_compute/graph/nodes/QuantizationLayer.h b/arm_compute/graph/nodes/QuantizationLayer.h deleted file mode 100644 index a3ef02530e..0000000000 --- a/arm_compute/graph/nodes/QuantizationLayer.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2017 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_QUANTIZATION_LAYER_H__ -#define __ARM_COMPUTE_GRAPH_QUANTIZATION_LAYER_H__ - -#include "arm_compute/graph/GraphContext.h" -#include "arm_compute/graph/INode.h" -#include "arm_compute/graph/ITensorObject.h" -#include "arm_compute/graph/Types.h" - -namespace arm_compute -{ -namespace graph -{ -/** Quantization layer node */ -class QuantizationLayer final : public INode -{ -public: - // Inherited methods overriden: - std::unique_ptr<arm_compute::IFunction> instantiate_node(GraphContext &ctx, ITensorObject *input, ITensorObject *output) override; -}; -} // namespace graph -} // namespace arm_compute -#endif /* __ARM_COMPUTE_GRAPH_QUANTIZATION_LAYER_H__ */ diff --git a/arm_compute/graph/nodes/ReshapeLayer.h b/arm_compute/graph/nodes/ReshapeLayer.h deleted file mode 100644 index b727d33a2c..0000000000 --- a/arm_compute/graph/nodes/ReshapeLayer.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2017 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_RESHAPE_LAYER_H__ -#define __ARM_COMPUTE_GRAPH_RESHAPE_LAYER_H__ - -#include "arm_compute/graph/GraphContext.h" -#include "arm_compute/graph/INode.h" -#include "arm_compute/graph/ITensorObject.h" -#include "arm_compute/graph/Types.h" - -namespace arm_compute -{ -namespace graph -{ -/** Reshape layer node */ -class ReshapeLayer final : public INode -{ -public: - /** Default constructor - * - * @param[in] shape Output shape - */ - ReshapeLayer(const TensorShape shape); - - // Inherited methods overriden: - std::unique_ptr<arm_compute::IFunction> instantiate_node(GraphContext &ctx, ITensorObject *input, ITensorObject *output) override; - -private: - TensorShape _shape; -}; -} // namespace graph -} // namespace arm_compute -#endif /* __ARM_COMPUTE_GRAPH_RESHAPE_LAYER_H__ */ diff --git a/arm_compute/graph2/nodes/ReshapeLayerNode.h b/arm_compute/graph/nodes/ReshapeLayerNode.h index 27d52601da..ded344e041 100644 --- a/arm_compute/graph2/nodes/ReshapeLayerNode.h +++ b/arm_compute/graph/nodes/ReshapeLayerNode.h @@ -21,14 +21,14 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#ifndef __ARM_COMPUTE_GRAPH2_RESHAPE_LAYER_NODE_H__ -#define __ARM_COMPUTE_GRAPH2_RESHAPE_LAYER_NODE_H__ +#ifndef __ARM_COMPUTE_GRAPH_RESHAPE_LAYER_NODE_H__ +#define __ARM_COMPUTE_GRAPH_RESHAPE_LAYER_NODE_H__ -#include "arm_compute/graph2/INode.h" +#include "arm_compute/graph/INode.h" namespace arm_compute { -namespace graph2 +namespace graph { /** Reshape Layer node */ class ReshapeLayerNode final : public INode @@ -50,6 +50,6 @@ public: private: TensorShape _shape; }; -} // namespace graph2 +} // namespace graph } // namespace arm_compute -#endif /* __ARM_COMPUTE_GRAPH2_RESHAPE_LAYER_NODE_H__ */ +#endif /* __ARM_COMPUTE_GRAPH_RESHAPE_LAYER_NODE_H__ */ diff --git a/arm_compute/graph/nodes/ResidualLayer.h b/arm_compute/graph/nodes/ResidualLayer.h deleted file mode 100644 index 27e0501739..0000000000 --- a/arm_compute/graph/nodes/ResidualLayer.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2017-2018 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_RESIDUAL_LAYER_H__ -#define __ARM_COMPUTE_GRAPH_RESIDUAL_LAYER_H__ - -#include "arm_compute/graph/GraphContext.h" -#include "arm_compute/graph/INode.h" -#include "arm_compute/graph/ITensorObject.h" -#include "arm_compute/graph/SubGraph.h" -#include "arm_compute/graph/Types.h" - -#include "arm_compute/core/utils/misc/Utility.h" - -#include <vector> - -namespace arm_compute -{ -namespace graph -{ -/** Branch Layer node */ -class ResidualLayer final : public INode -{ -public: - /** Default Constructor - * - * @param[in] sub_graph1 First graph branch - * @param[in] sub_graph2 Second graph branch - */ - template <typename... Ts> - ResidualLayer(SubGraph &&sub_graph1, SubGraph &&sub_graph2) - : _sub_graphs() - { - _sub_graphs.push_back(arm_compute::support::cpp14::make_unique<SubGraph>(std::move(sub_graph1))); - _sub_graphs.push_back(arm_compute::support::cpp14::make_unique<SubGraph>(std::move(sub_graph2))); - } - /** Default Constructor - * - * @param[in] sub_graph Sub graph - */ - template <typename... Ts> - ResidualLayer(SubGraph &&sub_graph) - : _sub_graphs() - { - _sub_graphs.push_back(arm_compute::support::cpp14::make_unique<SubGraph>(std::move(sub_graph))); - } - - // Inherited methods overriden: - std::unique_ptr<arm_compute::IFunction> instantiate_node(GraphContext &ctx, ITensorObject *input, ITensorObject *output) override; - -private: - std::vector<std::unique_ptr<SubGraph>> _sub_graphs; -}; -} // namespace graph -} // namespace arm_compute -#endif /* __ARM_COMPUTE_GRAPH_RESIDUAL_LAYER_H__ */ diff --git a/arm_compute/graph/nodes/SoftmaxLayer.h b/arm_compute/graph/nodes/SoftmaxLayer.h deleted file mode 100644 index b5d1bc53fd..0000000000 --- a/arm_compute/graph/nodes/SoftmaxLayer.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2017 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_SOFTMAX_LAYER_H__ -#define __ARM_COMPUTE_GRAPH_SOFTMAX_LAYER_H__ - -#include "arm_compute/graph/GraphContext.h" -#include "arm_compute/graph/INode.h" -#include "arm_compute/graph/ITensorObject.h" -#include "arm_compute/graph/Types.h" -namespace arm_compute -{ -namespace graph -{ -/** Softmax layer node */ -class SoftmaxLayer final : public INode -{ -public: - // Inherited methods overriden: - std::unique_ptr<arm_compute::IFunction> instantiate_node(GraphContext &ctx, ITensorObject *input, ITensorObject *output) override; -}; -} // namespace graph -} // namespace arm_compute -#endif /* __ARM_COMPUTE_GRAPH_SOFTMAX_LAYER_H__ */ diff --git a/arm_compute/graph2/nodes/SoftmaxLayerNode.h b/arm_compute/graph/nodes/SoftmaxLayerNode.h index b1091e28fc..8b716047ff 100644 --- a/arm_compute/graph2/nodes/SoftmaxLayerNode.h +++ b/arm_compute/graph/nodes/SoftmaxLayerNode.h @@ -21,14 +21,14 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#ifndef __ARM_COMPUTE_GRAPH2_SOFTMAX_LAYER_NODE_H__ -#define __ARM_COMPUTE_GRAPH2_SOFTMAX_LAYER_NODE_H__ +#ifndef __ARM_COMPUTE_GRAPH_SOFTMAX_LAYER_NODE_H__ +#define __ARM_COMPUTE_GRAPH_SOFTMAX_LAYER_NODE_H__ -#include "arm_compute/graph2/INode.h" +#include "arm_compute/graph/INode.h" namespace arm_compute { -namespace graph2 +namespace graph { /** Softmax Layer node */ class SoftmaxLayerNode final : public INode @@ -55,6 +55,6 @@ public: private: float _beta; }; -} // namespace graph2 +} // namespace graph } // namespace arm_compute -#endif /* __ARM_COMPUTE_GRAPH2_SOFTMAX_LAYER_NODE_H__ */ +#endif /* __ARM_COMPUTE_GRAPH_SOFTMAX_LAYER_NODE_H__ */ diff --git a/arm_compute/graph2/nodes/SplitLayerNode.h b/arm_compute/graph/nodes/SplitLayerNode.h index 90e6134ac0..923b3d1fa6 100644 --- a/arm_compute/graph2/nodes/SplitLayerNode.h +++ b/arm_compute/graph/nodes/SplitLayerNode.h @@ -21,16 +21,16 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#ifndef __ARM_COMPUTE_GRAPH2_SPLIT_LAYER_NODE_H__ -#define __ARM_COMPUTE_GRAPH2_SPLIT_LAYER_NODE_H__ +#ifndef __ARM_COMPUTE_GRAPH_SPLIT_LAYER_NODE_H__ +#define __ARM_COMPUTE_GRAPH_SPLIT_LAYER_NODE_H__ -#include "arm_compute/graph2/INode.h" +#include "arm_compute/graph/INode.h" #include <tuple> namespace arm_compute { -namespace graph2 +namespace graph { /** Split Layer node */ class SplitLayerNode final : public INode @@ -74,6 +74,6 @@ private: unsigned int _num_splits; unsigned int _axis; }; -} // namespace graph2 +} // namespace graph } // namespace arm_compute -#endif /* __ARM_COMPUTE_GRAPH2_SPLIT_LAYER_NODE_H__ */ +#endif /* __ARM_COMPUTE_GRAPH_SPLIT_LAYER_NODE_H__ */ diff --git a/arm_compute/graph2/printers/DotGraphPrinter.h b/arm_compute/graph/printers/DotGraphPrinter.h index 0efdf772e3..1d355a52ee 100644 --- a/arm_compute/graph2/printers/DotGraphPrinter.h +++ b/arm_compute/graph/printers/DotGraphPrinter.h @@ -21,18 +21,18 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#ifndef __ARM_COMPUTE_GRAPH2_DOTGRAPHPRINTER_H__ -#define __ARM_COMPUTE_GRAPH2_DOTGRAPHPRINTER_H__ +#ifndef __ARM_COMPUTE_GRAPH_DOTGRAPHPRINTER_H__ +#define __ARM_COMPUTE_GRAPH_DOTGRAPHPRINTER_H__ -#include "arm_compute/graph2/IGraphPrinter.h" +#include "arm_compute/graph/IGraphPrinter.h" -#include "arm_compute/graph2/INodeVisitor.h" +#include "arm_compute/graph/INodeVisitor.h" #include <string> namespace arm_compute { -namespace graph2 +namespace graph { /** Graph printer visitor. */ class DotGraphVisitor final : public DefaultNodeVisitor @@ -100,6 +100,6 @@ private: private: DotGraphVisitor _dot_node_visitor = {}; }; -} // namespace graph2 +} // namespace graph } // namespace arm_compute -#endif /* __ARM_COMPUTE_GRAPH2_DOTGRAPHPRINTER_H__ */ +#endif /* __ARM_COMPUTE_GRAPH_DOTGRAPHPRINTER_H__ */ diff --git a/arm_compute/graph2/printers/Printers.h b/arm_compute/graph/printers/Printers.h index 0b70139683..935e2bbbb0 100644 --- a/arm_compute/graph2/printers/Printers.h +++ b/arm_compute/graph/printers/Printers.h @@ -21,9 +21,9 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#ifndef __ARM_COMPUTE_GRAPH2_PRINTERS_H__ -#define __ARM_COMPUTE_GRAPH2_PRINTERS_H__ +#ifndef __ARM_COMPUTE_GRAPH_PRINTERS_H__ +#define __ARM_COMPUTE_GRAPH_PRINTERS_H__ -#include "arm_compute/graph2/printers/DotGraphPrinter.h" +#include "arm_compute/graph/printers/DotGraphPrinter.h" -#endif /* __ARM_COMPUTE_GRAPH2_PRINTERS_H__ */ +#endif /* __ARM_COMPUTE_GRAPH_PRINTERS_H__ */ diff --git a/arm_compute/graph2.h b/arm_compute/graph2.h deleted file mode 100644 index 5f54990ba8..0000000000 --- a/arm_compute/graph2.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2018 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_GRAPH2_H__ -#define __ARM_COMPUTE_GRAPH2_H__ - -// IR -#include "arm_compute/graph2/Edge.h" -#include "arm_compute/graph2/Graph.h" -#include "arm_compute/graph2/GraphBuilder.h" -#include "arm_compute/graph2/IDeviceBackend.h" -#include "arm_compute/graph2/IGraphMutator.h" -#include "arm_compute/graph2/IGraphPrinter.h" -#include "arm_compute/graph2/INode.h" -#include "arm_compute/graph2/INodeVisitor.h" -#include "arm_compute/graph2/Logger.h" -#include "arm_compute/graph2/Tensor.h" -#include "arm_compute/graph2/TensorDescriptor.h" -#include "arm_compute/graph2/TypePrinter.h" -#include "arm_compute/graph2/Types.h" - -// Algorithms -#include "arm_compute/graph2/algorithms/Algorithms.h" -#include "arm_compute/graph2/mutators/GraphMutators.h" -#include "arm_compute/graph2/nodes/Nodes.h" -#include "arm_compute/graph2/printers/Printers.h" - -// Frontend -#include "arm_compute/graph2/frontend/IStreamOperators.h" -#include "arm_compute/graph2/frontend/Layers.h" -#include "arm_compute/graph2/frontend/Stream.h" -#include "arm_compute/graph2/frontend/SubStream.h" -#include "arm_compute/graph2/frontend/Types.h" - -#endif /* __ARM_COMPUTE_GRAPH2_H__ */ diff --git a/arm_compute/graph2/Graph.h b/arm_compute/graph2/Graph.h deleted file mode 100644 index a601598e97..0000000000 --- a/arm_compute/graph2/Graph.h +++ /dev/null @@ -1,262 +0,0 @@ -/* - * Copyright (c) 2018 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_GRAPH2_GRAPH_H__ -#define __ARM_COMPUTE_GRAPH2_GRAPH_H__ - -#include "arm_compute/graph2/Edge.h" -#include "arm_compute/graph2/INode.h" -#include "arm_compute/graph2/Tensor.h" -#include "arm_compute/graph2/Types.h" - -#include "support/Mutex.h" -#include "support/ToolchainSupport.h" - -#include <map> -#include <memory> -#include <string> -#include <thread> -#include <utility> -#include <vector> - -namespace arm_compute -{ -namespace graph2 -{ -/** Graph class - * - * Represents a multiple source - multiple sink directed graph - */ -class Graph final -{ -public: - Graph() = default; - /** Constructor - * - * @param[in] id Graph identification number. Can be used to differentiate between graphs. Default value 0 - * @param[in] name Graph name. Default value empty string - */ - Graph(GraphID id, std::string name); - /** Prevent instances of this class from being copied (As this class contains pointers) */ - Graph(const Graph &) = delete; - /** Prevent instances of this class from being copy assigned (As this class contains pointers) */ - Graph &operator=(const Graph &) = delete; - /** Allow instances of this class to be moved */ - Graph(Graph &&) = default; - /** Allow instances of this class to be move assigned */ - Graph &operator=(Graph &&) = default; - /** Adds a node to the graph - * - * @note Models a single output node - * - * @tparam NT Node operation - * @tparam Ts Arguments to operation - * - * @param args Node arguments - * - * @return ID of the node - */ - template <typename NT, typename... Ts> - NodeID add_node(Ts &&... args); - /** Remove the node with the given ID - * - * @param[in] nid ID of the node to remove - * - * @return True if the removal took place else false - */ - bool remove_node(NodeID nid); - /** Adds a connection between two nodes - * - * @param[in] source ID of the source node - * @param[in] source_idx Output index of the source node - * @param[in] sink ID of the sink node - * @param[in] sink_idx Input index of the sink node - * - * @return ID of this connection - */ - EdgeID add_connection(NodeID source, size_t source_idx, NodeID sink, size_t sink_idx); - /** Removes an edge (connection) - * - * @param[in] eid Connection to remove - * - * @return True if the removal took place else false - */ - bool remove_connection(EdgeID eid); - /** Returns graph name - * - * @return Graph name - */ - std::string name() const; - /** Returns graph id - * - * @return Graph id - */ - GraphID id() const; - /** Returns graph input nodes - * - * @return vector containing the graph inputs - */ - const std::vector<NodeID> &inputs(); - /** Returns nodes of graph - * - * @warning Nodes can be nullptr if they have been removed during the mutation steps of the graph - * - * @return Nodes of graph - */ - std::vector<std::unique_ptr<INode>> &nodes(); - /** Returns nodes of graph - * - * @warning Nodes can be nullptr if they have been removed during the mutation steps of the graph - * - * @return Nodes of graph - */ - const std::vector<std::unique_ptr<INode>> &nodes() const; - /** Returns edges of graph - * - * @warning Edges can be nullptr if they have been removed during the mutation steps of the graph - * - * @return Edges of graph - */ - const std::vector<std::unique_ptr<Edge>> &edges() const; - /** Returns tensors of graph - * - * @warning Tensor can be nullptr if they have been removed during the mutation steps of the graph - * - * @return Tensors of graph - */ - std::vector<std::unique_ptr<Tensor>> &tensors(); - /** Returns tensors of graph - * - * @warning Tensor can be nullptr if they have been removed during the mutation steps of the graph - * - * @return Tensors of graph - */ - const std::vector<std::unique_ptr<Tensor>> &tensors() const; - /** Get node object given its id - * - * @warning Can be nullptr if node was removed during the mutation steps of the graph - * - * @param[in] id Node ID - * - * @return The actual node object - */ - const INode *node(NodeID id) const; - /** Get node object given its id - * - * @warning Can be nullptr if node was removed during the mutation steps of the graph - * - * @param[in] id Node ID - * - * @return The actual node object - */ - INode *node(NodeID id); - /** Get edge object given its id - * - * @warning Can be nullptr if node was removed during the mutation steps of the graph - * - * @param[in] id Edge ID - * - * @return The actual edge object - */ - const Edge *edge(EdgeID id) const; - /** Get edge object given its id - * - * @warning Can be nullptr if node was removed during the mutation steps of the graph - * - * @param[in] id Edge ID - * - * @return The actual edge object - */ - Edge *edge(EdgeID id); - /** Get tensor object given its id - * - * @warning Can be nullptr if tensor was removed during the mutation steps of the graph - * - * @param[in] id Tensor ID - * - * @return The actual tensor object - */ - const Tensor *tensor(TensorID id) const; - /** Get tensor object given its id - * - * @warning Can be nullptr if tensor was removed during the mutation steps of the graph - * - * @param[in] id Tensor ID - * - * @return The actual tensor object - */ - Tensor *tensor(TensorID id); - -private: - /** Creates a tensor object - * - * @param[in] desc Tensor descriptor - * - * @return Tensor ID - */ - TensorID create_tensor(TensorDescriptor desc = TensorDescriptor()); - -private: - GraphID _id = GraphID(0); /**< Graph id */ - std::string _name = {}; /**< Graph name */ - std::vector<std::unique_ptr<INode>> _nodes = {}; /**< Graph nodes */ - std::vector<std::unique_ptr<Edge>> _edges = {}; /**< Graph edges */ - std::vector<std::unique_ptr<Tensor>> _tensors = {}; /**< Graph tensors */ - std::map<NodeType, std::vector<NodeID>> _tagged_nodes = {}; /**< Graph nodes map with the node type as key */ - arm_compute::Mutex _mtx = {}; /**< Mutex used for graph construction */ -}; - -template <typename NT, typename... Ts> -inline NodeID Graph::add_node(Ts &&... args) -{ - std::lock_guard<arm_compute::Mutex> lock(_mtx); - - // Create node - NodeID nid = _nodes.size(); - auto node = support::cpp14::make_unique<NT>(std::forward<Ts>(args)...); - node->set_graph(this); - node->set_id(nid); - - // Keep track of input nodes - if(node->type() == NodeType::Input) - { - _tagged_nodes[NodeType::Input].push_back(nid); - } - - // Associate a new tensor with each output - for(auto &output : node->_outputs) - { - output = create_tensor(); - } - - // Propagate node shape if possible - node->forward_descriptors(); - - // Add node to the graph nodes - _nodes.push_back(std::move(node)); - - return nid; -} -} // namespace graph2 -} // namespace arm_compute -#endif /* __ARM_COMPUTE_GRAPH2_GRAPH_H__ */ diff --git a/arm_compute/graph2/GraphContext.h b/arm_compute/graph2/GraphContext.h deleted file mode 100644 index f38e25dd61..0000000000 --- a/arm_compute/graph2/GraphContext.h +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (c) 2018 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_GRAPH2_GRAPH_CONTEXT_H__ -#define __ARM_COMPUTE_GRAPH2_GRAPH_CONTEXT_H__ - -#include "arm_compute/graph2/Types.h" - -#include "arm_compute/runtime/IMemoryManager.h" - -#include <map> -#include <memory> - -namespace arm_compute -{ -namespace graph2 -{ -/** Contains structs required for memory management */ -struct MemoryManagerContext -{ - Target target = { Target::UNSPECIFIED }; /**< Target */ - std::shared_ptr<arm_compute::IMemoryManager> mm = { nullptr }; /**< Memory manager */ -}; - -/** Graph context **/ -class GraphContext final -{ -public: - /** Constructor */ - GraphContext(); - /** Prevent instances of this class from being copied (As this class contains pointers) */ - GraphContext(const GraphContext &) = delete; - /** Default move constructor */ - GraphContext(GraphContext &&) = default; - /** Prevent instances of this class from being copied (As this class contains pointers) */ - GraphContext &operator=(const GraphContext &) = delete; - /** Default move assignment operator */ - GraphContext &operator=(GraphContext &&) = default; - /** Graph configuration accessor - * - * @note Every alteration has to be done before graph finalization - * - * @return The graph configuration - */ - const GraphConfig &config() const; - /** Sets graph configuration - * - * @param[in] config Configuration to use - */ - void set_config(const GraphConfig &config); - /** Inserts a memory manager context - * - * @param[in] memory_ctx Memory manage context - * - * @return If the insertion succeeded else false - */ - bool insert_memory_management_ctx(MemoryManagerContext &&memory_ctx); - /** Gets a memory manager context for a given target - * - * @param[in] target To retrieve the management context - * - * @return Management context for the target if exists else nullptr - */ - MemoryManagerContext *memory_management_ctx(Target target); - /** Finalizes memory managers in graph context */ - void finalize(); - -private: - GraphConfig _config; /**< Graph configuration */ - std::map<Target, MemoryManagerContext> _memory_managers; /**< Memory managers for each target */ -}; -} // namespace graph2 -} // namespace arm_compute -#endif /* __ARM_COMPUTE_GRAPH2_GRAPH_CONTEXT_H__ */ diff --git a/arm_compute/graph2/INode.h b/arm_compute/graph2/INode.h deleted file mode 100644 index ba5620ba0e..0000000000 --- a/arm_compute/graph2/INode.h +++ /dev/null @@ -1,252 +0,0 @@ -/* - * Copyright (c) 2018 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_GRAPH2_INODE_H__ -#define __ARM_COMPUTE_GRAPH2_INODE_H__ - -#include "arm_compute/core/Error.h" -#include "arm_compute/graph2/TensorDescriptor.h" -#include "arm_compute/graph2/Types.h" - -#include <set> - -namespace arm_compute -{ -namespace graph2 -{ -// Forward declarations -class Graph; -class Edge; -class INodeVisitor; -class Tensor; - -/** Node interface */ -class INode -{ -public: - /** Constructor */ - INode(); - /** Destructor **/ - virtual ~INode() = default; - /** Prevent instances of this class from being copied (As this class contains pointers) */ - INode(const INode &) = delete; - /** Prevent instances of this class from being copy assigned (As this class contains pointers) */ - INode &operator=(const INode &) = delete; - /** Allow instances of this class to be moved */ - INode(INode &&) = default; - /** Allow instances of this class to be move assigned */ - INode &operator=(INode &&) = default; - /** Validate node - * - * @return Status containing any errors - */ - virtual Status validate() = 0; - /** Returns node's type - * - * @return Node's type - */ - virtual NodeType type() const = 0; - /** Accepts a node visitor - * - * @param[in] v Visitor to accept - */ - virtual void accept(INodeVisitor &v) = 0; - /** Forwards descriptor information to outputs if possible - * - * @return True if descriptor information could be forwarded otherwise false - */ - virtual bool forward_descriptors() = 0; - /** Calculates output configuration - * - * @param[in] idx Output index to configure - * - * @return Output descriptor configuration - */ - virtual TensorDescriptor configure_output(size_t idx) const = 0; - /** Returns node's name - * - * @return Node name - */ - std::string name() const; - /** Returns node's ID - * - * @return Node's ID - */ - NodeID id() const; - /** Returns node's Graph - * - * @return Node's graph - */ - const Graph *graph() const; - /** Returns node's Graph - * - * @return Node's graph - */ - Graph *graph(); - /** Sets the graph that this node is registered to - * - * @param[in] g Back reference to graph - */ - void set_graph(Graph *g); - /** Sets the node id - * - * @param[in] id Node id - */ - void set_id(NodeID id); - /** Sets common node parameters - * - * @param[in] common_params Common node parameters to set - */ - void set_common_node_parameters(NodeParams common_params); - /** Sets target preference - * - * @note This is not the target that the graph executor might choose, its just an indication - * - * @param[in] target Target preference - */ - void set_requested_target(Target target); - /** Sets the final execution target - * - * @note GraphManager might change this target - * - * @param[in] target Final execution target - */ - void set_assigned_target(Target target); - /** Sets the output tensor of at a given index - * - * @note All edges will get updated - * - * @param[in] tid Tensor ID - * @param[in] idx Output index - */ - void set_output_tensor(TensorID tid, size_t idx); - /** Returns inputs of the node - * - * @return Inputs of the node - */ - const std::vector<TensorID> &inputs() const; - /** Returns outputs of the node - * - * @return Outputs of the node - */ - const std::vector<TensorID> &outputs() const; - /** Returns input edge set - * - * @return Set of input edges - */ - const std::vector<EdgeID> &input_edges() const; - /** Returns output edge set - * - * @return Set of output edges - */ - const std::set<EdgeID> &output_edges() const; - /** Returns the tensor ID of a given input of the node - * - * @note Precondition : idx should be a valid input index - * - * @param[in] idx Index of the node input - * - * @return TensorID of the requested input - */ - TensorID input_id(size_t idx) const; - /** Returns the tensor ID of a given output of the node - * - * @note Precondition : idx should be a valid output index - * - * @param[in] idx Index of the node output - * - * @return TensorID of the requested output - */ - TensorID output_id(size_t idx) const; - /** Returns the tensor of a given input of the node - * - * @note Precondition : idx should be a valid input index - * - * @param[in] idx Index of the node input - * - * @return Tensor of the requested input - */ - Tensor *input(size_t idx) const; - /** Returns the tensor of a given output of the node - * - * @note Precondition : idx should be a valid output index - * - * @param[in] idx Index of the node output - * - * @return Tensor of the requested output - */ - Tensor *output(size_t idx) const; - /** Returns the edge ID of a given input of the node - * - * @note Precondition : idx should be a valid input index - * - * @param[in] idx Index of the node input - * - * @return EdgeID of the requested input - */ - EdgeID input_edge_id(size_t idx) const; - /** Returns the edge of a given input of the node - * - * @note Precondition : idx should be a valid input index - * - * @param[in] idx Index of the node input - * - * @return Edge of the requested input - */ - Edge *input_edge(size_t idx) const; - /** Returns number of inputs of the node - * - * @return Number of inputs - */ - size_t num_inputs() const; - /** Returns number of outputs of the node - * - * @return Number of outputs - */ - size_t num_outputs() const; - /** Returns requested target for this node - * - * @return Requested execution target - */ - Target requested_target() const; - /** Returns assigned target for this node - * - * @return Assigned target of this node - */ - Target assigned_target() const; - -protected: - friend class Graph; - -protected: - Graph *_graph; /**< Backward reference to graph owning the node */ - NodeID _id; /**< Node ID */ - NodeParams _common_params; /**< Node common params */ - std::vector<TensorID> _outputs; /**< Output of the node */ - std::vector<EdgeID> _input_edges; /**< Inputs edge set */ - std::set<EdgeID> _output_edges; /**< Output edge set */ - Target _assigned_target; /**< Assigned target by the Graph executor */ -}; -} // namespace graph2 -} // namespace arm_compute -#endif /* __ARM_COMPUTE_GRAPH_INODE_H__ */ diff --git a/arm_compute/graph2/ITensorAccessor.h b/arm_compute/graph2/ITensorAccessor.h deleted file mode 100644 index 1a7277344d..0000000000 --- a/arm_compute/graph2/ITensorAccessor.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2018 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_GRAPH2_ITENSOR_ACCESSOR_H__ -#define __ARM_COMPUTE_GRAPH2_ITENSOR_ACCESSOR_H__ - -#include "arm_compute/graph/ITensorAccessor.h" - -#include <memory> - -namespace arm_compute -{ -namespace graph2 -{ -// Forward Declarations -class ITensorHandle; -using ITensorAccessor = graph::ITensorAccessor; -using ITensorAccessorUPtr = std::unique_ptr<ITensorAccessor>; -} // namespace graph2 -} // namespace arm_compute -#endif /* __ARM_COMPUTE_GRAPH2_SUB_STREAM_H__ */
\ No newline at end of file diff --git a/arm_compute/graph2/Tensor.h b/arm_compute/graph2/Tensor.h deleted file mode 100644 index fcba854a3e..0000000000 --- a/arm_compute/graph2/Tensor.h +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Copyright (c) 2018 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_GRAPH2_TENSOR_H__ -#define __ARM_COMPUTE_GRAPH2_TENSOR_H__ - -#include "arm_compute/graph2/Types.h" - -#include "arm_compute/graph2/ITensorAccessor.h" -#include "arm_compute/graph2/ITensorHandle.h" -#include "arm_compute/graph2/TensorDescriptor.h" - -#include <memory> - -namespace arm_compute -{ -namespace graph2 -{ -/** Tensor object **/ -class Tensor final -{ -public: - /** Default constructor - * - * @param[in] id Tensor ID - * @param[in] desc Tensor information - */ - Tensor(TensorID id, TensorDescriptor desc); - /** Tensor ID accessor - * - * @return Tensor ID - */ - TensorID id() const; - /** TensorInfo metadata accessor - * - * @return Tensor descriptor metadata - */ - TensorDescriptor &desc(); - /** TensorInfo metadata accessor - * - * @return Tensor descriptor metadata - */ - const TensorDescriptor &desc() const; - /** Sets the backend tensor - * - * @param[in] backend_tensor Backend tensor to set - */ - void set_handle(std::unique_ptr<ITensorHandle> backend_tensor); - /** Backend tensor handle accessor - * - * @return Backend tensor handle - */ - ITensorHandle *handle(); - /** Sets the backend tensor accessor - * - * @param[in] accessor Accessor to set - */ - void set_accessor(std::unique_ptr<ITensorAccessor> accessor); - /** Backend tensor accessor - * - * @return Backend tensor accessor - */ - ITensorAccessor *accessor(); - /** Calls accessor on tensor - * - * @return True if the accessor was called else false - */ - bool call_accessor(); - /** Binds the tensor with an edge - * - * @param[in] eid Edge ID that is bound to the tensor - */ - void bind_edge(EdgeID eid); - /** Unbinds an edge from a tensor - * - * @param[in] eid Edge to unbind - */ - void unbind_edge(EdgeID eid); - /** Accessor the edges that are bound with the tensor - * - * @return Bound edges - */ - const std::set<EdgeID> bound_edges() const; - -private: - TensorID _id; /**< Tensor id */ - TensorDescriptor _desc; /**< Tensor metadata */ - std::unique_ptr<ITensorHandle> _handle; /**< Tensor Handle */ - std::unique_ptr<ITensorAccessor> _accessor; /**< Tensor Accessor */ - std::set<EdgeID> _bound_edges; /**< Edges bound to this tensor */ -}; -} // namespace graph2 -} // namespace arm_compute -#endif /* __ARM_COMPUTE_GRAPH2_TENSOR_H__ */ diff --git a/arm_compute/graph2/Types.h b/arm_compute/graph2/Types.h deleted file mode 100644 index 2625657393..0000000000 --- a/arm_compute/graph2/Types.h +++ /dev/null @@ -1,171 +0,0 @@ -/* - * Copyright (c) 2018 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_GRAPH2_TYPES_H__ -#define __ARM_COMPUTE_GRAPH2_TYPES_H__ - -#include "arm_compute/core/Error.h" -#include "arm_compute/core/Types.h" -#include "arm_compute/core/utils/strong_type/StrongType.h" -#include "arm_compute/core/utils/strong_type/StrongTypeAttributes.h" - -#include <limits> -#include <string> - -namespace arm_compute -{ -namespace graph2 -{ -using arm_compute::Status; - -using arm_compute::Coordinates; -using arm_compute::DataType; -using arm_compute::TensorShape; -using arm_compute::Size2D; - -using arm_compute::ActivationLayerInfo; -using arm_compute::NormType; -using arm_compute::NormalizationLayerInfo; -using arm_compute::PadStrideInfo; -using arm_compute::PoolingLayerInfo; -using arm_compute::PoolingType; -using arm_compute::DimensionRoundingType; - -/** TODO (geopin01): Make ids strongly typed */ -using TensorID = unsigned int; -using NodeID = unsigned int; -using EdgeID = unsigned int; -using Activation = arm_compute::ActivationLayerInfo::ActivationFunction; - -/**< GraphID strong type */ -using GraphID = strong_type::StrongType<unsigned int, struct graph_id_t, strong_type::Comparable>; -/* TODO (geopin01): Strong types for NodeID */ - -/**< Constant TensorID specifying an equivalent of null tensor */ -constexpr TensorID NullTensorID = std::numeric_limits<TensorID>::max(); -/**< Constant NodeID specifying an equivalent of null node */ -constexpr NodeID EmptyNodeID = std::numeric_limits<NodeID>::max(); -/**< Constant EdgeID specifying an equivalent of null edge */ -constexpr EdgeID EmptyEdgeID = std::numeric_limits<EdgeID>::max(); - -// Forward declarations -class TensorDescriptor; - -/** Graph configuration structure */ -struct GraphConfig -{ - bool use_function_memory_manager{ false }; /**< Use a memory manager to manage per-funcion auxilary memory */ - bool use_transition_memory_manager{ false }; /**< Use a memory manager to manager transition buffer memory */ - bool use_tuner{ false }; /**< Use a tuner in tunable backends */ - unsigned int num_threads{ 0 }; /**< Number of threads to use (thread capable backends), if 0 the backend will auto-initialize */ -}; - -/**< Data layout format */ -enum class DataLayout -{ - NCHW, /** N(Batches), C(Channels), H(Height), W(Width) from slow to fast moving dimension */ - NHWC /** N(Batches), H(Height), W(Width), C(Channels) from slow to fast moving dimension */ -}; - -/**< Device target types */ -enum class Target -{ - UNSPECIFIED, /**< Unspecified Target */ - NEON, /**< NEON capable target device */ - CL, /**< OpenCL capable target device */ - GC, /**< GLES compute capable target device */ -}; - -/** Supported Element-wise operations */ -enum class EltwiseOperation -{ - ADD, /**< Arithmetic addition */ - SUB, /**< Arithmetic subtraction */ - MUL /**< Arithmetic multiplication */ -}; - -/** Supported Convolution layer methods */ -enum class ConvolutionMethod -{ - DEFAULT, /**< Default approach using internal heuristics */ - GEMM, /**< GEMM based convolution */ - DIRECT, /**< Deep direct convolution */ - WINOGRAD /**< Winograd based convolution */ -}; - -/** Supported Depthwise Convolution layer methods */ -enum class DepthwiseConvolutionMethod -{ - DEFAULT, /**< Default approach using internal heuristics */ - GEMV, /**< Generic GEMV based depthwise convolution */ - OPTIMIZED_3x3, /**< Optimized 3x3 direct depthwise convolution */ -}; - -/** Supported nodes */ -enum class NodeType -{ - ActivationLayer, - BatchNormalizationLayer, - ConvolutionLayer, - DepthConcatenateLayer, - DepthwiseConvolutionLayer, - EltwiseLayer, - FlattenLayer, - FullyConnectedLayer, - NormalizationLayer, - PoolingLayer, - ReshapeLayer, - SoftmaxLayer, - SplitLayer, - - Input, - Output, - Const, -}; - -/** Backend Memory Manager affinity **/ -enum class MemoryManagerAffinity -{ - Buffer, /**< Affinity at buffer level */ - Offset /**< Affinity at offset level */ -}; - -/** NodeID-index struct - * - * Used to describe connections - */ -struct NodeIdxPair -{ - NodeID node_id; /**< Node ID */ - size_t index; /**< Index */ -}; - -/** Common node parameters */ -struct NodeParams -{ - std::string name; /**< Node name */ - Target target; /**< Node target */ -}; -} // namespace graph2 -} // namespace arm_compute -#endif /* __ARM_COMPUTE_GRAPH2_TYPES_H__ */ diff --git a/arm_compute/graph2/nodes/Nodes.h b/arm_compute/graph2/nodes/Nodes.h deleted file mode 100644 index 3786978661..0000000000 --- a/arm_compute/graph2/nodes/Nodes.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2018 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_GRAPH2_NODES_H__ -#define __ARM_COMPUTE_GRAPH2_NODES_H__ - -#include "arm_compute/graph2/nodes/ActivationLayerNode.h" -#include "arm_compute/graph2/nodes/BatchNormalizationLayerNode.h" -#include "arm_compute/graph2/nodes/ConstNode.h" -#include "arm_compute/graph2/nodes/ConvolutionLayerNode.h" -#include "arm_compute/graph2/nodes/DepthConcatenateLayerNode.h" -#include "arm_compute/graph2/nodes/DepthwiseConvolutionLayerNode.h" -#include "arm_compute/graph2/nodes/EltwiseLayerNode.h" -#include "arm_compute/graph2/nodes/FlattenLayerNode.h" -#include "arm_compute/graph2/nodes/FullyConnectedLayerNode.h" -#include "arm_compute/graph2/nodes/InputNode.h" -#include "arm_compute/graph2/nodes/NormalizationLayerNode.h" -#include "arm_compute/graph2/nodes/OutputNode.h" -#include "arm_compute/graph2/nodes/PoolingLayerNode.h" -#include "arm_compute/graph2/nodes/ReshapeLayerNode.h" -#include "arm_compute/graph2/nodes/SoftmaxLayerNode.h" -#include "arm_compute/graph2/nodes/SplitLayerNode.h" - -#endif /* __ARM_COMPUTE_GRAPH2_NODES_H__ */ |