aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorgios Pinitas <georgios.pinitas@arm.com>2018-04-03 13:44:29 +0100
committerAnthony Barbier <anthony.barbier@arm.com>2018-11-02 16:49:16 +0000
commitd9eb27597eabe5b7c17520f4f9b3f8a282d72573 (patch)
tree9b2b7d74b0ef83623b18d6d4279a564e5b63d641
parenta8ca2b0cfe052c9a28b691317a674f28f495c139 (diff)
downloadComputeLibrary-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>
-rw-r--r--SConscript41
-rw-r--r--SConstruct1
-rw-r--r--arm_compute/core/CL/OpenCL.h2
-rw-r--r--arm_compute/core/Error.h2
-rw-r--r--arm_compute/graph.h (renamed from arm_compute/graph/nodes/DequantizationLayer.h)56
-rw-r--r--arm_compute/graph/CL/CLMap.h66
-rw-r--r--arm_compute/graph/CL/CLUnmap.h63
-rw-r--r--arm_compute/graph/Edge.h (renamed from arm_compute/graph2/Edge.h)16
-rw-r--r--arm_compute/graph/Error.h64
-rw-r--r--arm_compute/graph/Graph.h294
-rw-r--r--arm_compute/graph/GraphBuilder.h (renamed from arm_compute/graph2/GraphBuilder.h)14
-rw-r--r--arm_compute/graph/GraphContext.h90
-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.h227
-rw-r--r--arm_compute/graph/INodeVisitor.h (renamed from arm_compute/graph2/INodeVisitor.h)12
-rw-r--r--arm_compute/graph/IOperation.h72
-rw-r--r--arm_compute/graph/ITensorAccessor.h14
-rw-r--r--arm_compute/graph/ITensorHandle.h (renamed from arm_compute/graph2/ITensorHandle.h)10
-rw-r--r--arm_compute/graph/ITensorObject.h80
-rw-r--r--arm_compute/graph/Logger.h (renamed from arm_compute/graph2/Logger.h)6
-rw-r--r--arm_compute/graph/NodeContext.h142
-rw-r--r--arm_compute/graph/NodeParameter.h74
-rw-r--r--arm_compute/graph/OperationRegistrar.h59
-rw-r--r--arm_compute/graph/OperationRegistry.h86
-rw-r--r--arm_compute/graph/PassManager.h (renamed from arm_compute/graph2/PassManager.h)12
-rw-r--r--arm_compute/graph/SubGraph.h94
-rw-r--r--arm_compute/graph/SubTensor.h96
-rw-r--r--arm_compute/graph/Tensor.h124
-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.h166
-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.h54
-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.h70
-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.h88
-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.h128
-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.h58
-rw-r--r--arm_compute/graph/nodes/DepthwiseConvolutionLayer.h76
-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.h45
-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.h45
-rw-r--r--arm_compute/graph/nodes/FullyConnectedLayer.h64
-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.h56
-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.h54
-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.h54
-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.h45
-rw-r--r--arm_compute/graph/nodes/ReshapeLayer.h54
-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.h76
-rw-r--r--arm_compute/graph/nodes/SoftmaxLayer.h44
-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.h55
-rw-r--r--arm_compute/graph2/Graph.h262
-rw-r--r--arm_compute/graph2/GraphContext.h94
-rw-r--r--arm_compute/graph2/INode.h252
-rw-r--r--arm_compute/graph2/ITensorAccessor.h41
-rw-r--r--arm_compute/graph2/Tensor.h114
-rw-r--r--arm_compute/graph2/Types.h171
-rw-r--r--arm_compute/graph2/nodes/Nodes.h44
-rw-r--r--docs/00_introduction.dox37
-rw-r--r--examples/SConscript71
-rw-r--r--examples/graph_alexnet.cpp6
-rw-r--r--examples/graph_googlenet.cpp6
-rw-r--r--examples/graph_inception_v3.cpp6
-rw-r--r--examples/graph_inception_v4.cpp7
-rw-r--r--examples/graph_lenet.cpp6
-rw-r--r--examples/graph_mobilenet.cpp6
-rw-r--r--examples/graph_mobilenet_qasymm8.cpp17
-rw-r--r--examples/graph_resnet50.cpp6
-rw-r--r--examples/graph_squeezenet.cpp6
-rw-r--r--examples/graph_squeezenet_v1_1.cpp6
-rw-r--r--examples/graph_vgg16.cpp6
-rw-r--r--examples/graph_vgg19.cpp6
-rw-r--r--opencl-1.2-stubs/SConscript2
-rw-r--r--opengles-3.1-stubs/SConscript2
-rw-r--r--src/core/CL/OpenCL.cpp32
-rw-r--r--src/graph/CL/CLMap.cpp43
-rw-r--r--src/graph/CL/CLUnmap.cpp43
-rw-r--r--src/graph/Graph.cpp344
-rw-r--r--src/graph/GraphBuilder.cpp (renamed from src/graph2/GraphBuilder.cpp)14
-rw-r--r--src/graph/GraphContext.cpp56
-rw-r--r--src/graph/GraphManager.cpp (renamed from src/graph2/GraphManager.cpp)18
-rw-r--r--src/graph/INode.cpp176
-rw-r--r--src/graph/NodeContext.cpp75
-rw-r--r--src/graph/OperationRegistry.cpp61
-rw-r--r--src/graph/PassManager.cpp (renamed from src/graph2/PassManager.cpp)8
-rw-r--r--src/graph/SubGraph.cpp110
-rw-r--r--src/graph/SubTensor.cpp119
-rw-r--r--src/graph/Tensor.cpp141
-rw-r--r--src/graph/Utils.cpp (renamed from src/graph2/Utils.cpp)14
-rw-r--r--src/graph/Workload.cpp (renamed from src/graph2/Workload.cpp)10
-rw-r--r--src/graph/backends/BackendRegistry.cpp (renamed from src/graph2/backends/BackendRegistry.cpp)8
-rw-r--r--src/graph/backends/CL/CLDeviceBackend.cpp (renamed from src/graph2/backends/CL/CLDeviceBackend.cpp)33
-rw-r--r--src/graph/backends/CL/CLFunctionsFactory.cpp (renamed from src/graph2/backends/CL/CLFunctionsFactory.cpp)24
-rw-r--r--src/graph/backends/CL/CLNodeValidator.cpp (renamed from src/graph2/backends/CL/CLNodeValidator.cpp)10
-rw-r--r--src/graph/backends/CL/CLSubTensorHandle.cpp (renamed from src/graph2/backends/CL/CLSubTensorHandle.cpp)6
-rw-r--r--src/graph/backends/CL/CLTensorHandle.cpp (renamed from src/graph2/backends/CL/CLTensorHandle.cpp)6
-rw-r--r--src/graph/backends/GLES/GCDeviceBackend.cpp (renamed from src/graph2/backends/GLES/GCDeviceBackend.cpp)31
-rw-r--r--src/graph/backends/GLES/GCFunctionsFactory.cpp (renamed from src/graph2/backends/GLES/GCFunctionsFactory.cpp)24
-rw-r--r--src/graph/backends/GLES/GCNodeValidator.cpp (renamed from src/graph2/backends/GLES/GCNodeValidator.cpp)10
-rw-r--r--src/graph/backends/GLES/GCTensorHandle.cpp (renamed from src/graph2/backends/GLES/GCTensorHandle.cpp)6
-rw-r--r--src/graph/backends/NEON/NEDeviceBackend.cpp (renamed from src/graph2/backends/NEON/NEDeviceBackend.cpp)33
-rw-r--r--src/graph/backends/NEON/NEFunctionFactory.cpp (renamed from src/graph2/backends/NEON/NEFunctionFactory.cpp)20
-rw-r--r--src/graph/backends/NEON/NENodeValidator.cpp (renamed from src/graph2/backends/NEON/NENodeValidator.cpp)10
-rw-r--r--src/graph/backends/NEON/NESubTensorHandle.cpp (renamed from src/graph2/backends/NEON/NESubTensorHandle.cpp)6
-rw-r--r--src/graph/backends/NEON/NETensorHandle.cpp (renamed from src/graph2/backends/NEON/NETensorHandle.cpp)6
-rw-r--r--src/graph/detail/ExecutionHelpers.cpp (renamed from src/graph2/detail/ExecutionHelpers.cpp)16
-rw-r--r--src/graph/frontend/Stream.cpp (renamed from src/graph2/frontend/Stream.cpp)10
-rw-r--r--src/graph/frontend/SubStream.cpp (renamed from src/graph2/frontend/SubStream.cpp)10
-rw-r--r--src/graph/mutators/DepthConcatSubTensorMutator.cpp (renamed from src/graph2/mutators/DepthConcatSubTensorMutator.cpp)14
-rw-r--r--src/graph/mutators/InPlaceOperationMutator.cpp (renamed from src/graph2/mutators/InPlaceOperationMutator.cpp)10
-rw-r--r--src/graph/mutators/NodeFusionMutator.cpp (renamed from src/graph2/mutators/NodeFusionMutator.cpp)12
-rw-r--r--src/graph/mutators/SplitLayerSubTensorMutator.cpp (renamed from src/graph2/mutators/SplitLayerSubTensorMutator.cpp)14
-rw-r--r--src/graph/nodes/ActivationLayer.cpp56
-rw-r--r--src/graph/nodes/ActivationLayerNode.cpp (renamed from src/graph2/nodes/ActivationLayerNode.cpp)10
-rw-r--r--src/graph/nodes/BatchNormalizationLayer.cpp105
-rw-r--r--src/graph/nodes/BatchNormalizationLayerNode.cpp (renamed from src/graph2/nodes/BatchNormalizationLayerNode.cpp)10
-rw-r--r--src/graph/nodes/BranchLayer.cpp130
-rw-r--r--src/graph/nodes/ConstNode.cpp (renamed from src/graph2/nodes/ConstNode.cpp)10
-rw-r--r--src/graph/nodes/ConvolutionLayer.cpp363
-rw-r--r--src/graph/nodes/ConvolutionLayerNode.cpp (renamed from src/graph2/nodes/ConvolutionLayerNode.cpp)10
-rw-r--r--src/graph/nodes/DeQuantizationLayer.cpp68
-rw-r--r--src/graph/nodes/DepthConcatenateLayerNode.cpp (renamed from src/graph2/nodes/DepthConcatenateLayerNode.cpp)10
-rw-r--r--src/graph/nodes/DepthConvertLayer.cpp58
-rw-r--r--src/graph/nodes/DepthwiseConvolutionLayer.cpp91
-rw-r--r--src/graph/nodes/DepthwiseConvolutionLayerNode.cpp (renamed from src/graph2/nodes/DepthwiseConvolutionLayerNode.cpp)10
-rw-r--r--src/graph/nodes/EltwiseLayerNode.cpp (renamed from src/graph2/nodes/EltwiseLayerNode.cpp)10
-rw-r--r--src/graph/nodes/FlattenLayer.cpp54
-rw-r--r--src/graph/nodes/FlattenLayerNode.cpp (renamed from src/graph2/nodes/FlattenLayerNode.cpp)10
-rw-r--r--src/graph/nodes/FloorLayer.cpp49
-rw-r--r--src/graph/nodes/FullyConnectedLayer.cpp125
-rw-r--r--src/graph/nodes/InputNode.cpp (renamed from src/graph2/nodes/InputNode.cpp)10
-rw-r--r--src/graph/nodes/L2NormalizeLayer.cpp56
-rw-r--r--src/graph/nodes/NormalizationLayer.cpp55
-rw-r--r--src/graph/nodes/NormalizationLayerNode.cpp (renamed from src/graph2/nodes/NormalizationLayerNode.cpp)10
-rw-r--r--src/graph/nodes/OutputNode.cpp (renamed from src/graph2/nodes/OutputNode.cpp)12
-rw-r--r--src/graph/nodes/PoolingLayer.cpp55
-rw-r--r--src/graph/nodes/PoolingLayerNode.cpp (renamed from src/graph2/nodes/PoolingLayerNode.cpp)10
-rw-r--r--src/graph/nodes/QuantizationLayer.cpp48
-rw-r--r--src/graph/nodes/ReshapeLayer.cpp70
-rw-r--r--src/graph/nodes/ResidualLayer.cpp199
-rw-r--r--src/graph/nodes/SoftmaxLayer.cpp49
-rw-r--r--src/graph/nodes/SoftmaxLayerNode.cpp (renamed from src/graph2/nodes/SoftmaxLayerNode.cpp)10
-rw-r--r--src/graph/nodes/SplitLayerNode.cpp (renamed from src/graph2/nodes/SplitLayerNode.cpp)10
-rw-r--r--src/graph/operations/CLSimpleOperations.cpp495
-rw-r--r--src/graph/operations/NESimpleOperations.cpp495
-rw-r--r--src/graph/printers/DotGraphPrinter.cpp (renamed from src/graph2/printers/DotGraphPrinter.cpp)14
-rw-r--r--src/graph2/Graph.cpp227
-rw-r--r--src/graph2/GraphContext.cpp74
-rw-r--r--src/graph2/INode.cpp193
-rw-r--r--src/graph2/Tensor.cpp111
-rw-r--r--src/graph2/nodes/FullyConnectedLayer.cpp107
-rw-r--r--src/graph2/nodes/ReshapeLayer.cpp81
-rw-r--r--src/runtime/NEON/functions/NEWinogradLayer.cpp2
-rw-r--r--tests/SConscript87
-rw-r--r--utils/GraphTypePrinter.h88
-rw-r--r--utils/GraphUtils.cpp5
-rw-r--r--utils/GraphUtils.h35
212 files changed, 2004 insertions, 8397 deletions
diff --git a/SConscript b/SConscript
index 5a4b6ce5ed..936fde0f1f 100644
--- a/SConscript
+++ b/SConscript
@@ -170,9 +170,8 @@ runtime_files += Glob('src/runtime/CPP/functions/*.cpp')
# CLHarrisCorners uses the Scheduler to run CPP kernels
runtime_files += Glob('src/runtime/CPP/SingleThreadScheduler.cpp')
-# FIXME : Rename graph2 -> graph
-graph2_files = Glob('src/graph2/*.cpp')
-graph2_files += Glob('src/graph2/*/*.cpp')
+graph_files = Glob('src/graph/*.cpp')
+graph_files += Glob('src/graph/*/*.cpp')
if env['cppthreads']:
runtime_files += Glob('src/runtime/CPP/CPPScheduler.cpp')
@@ -188,7 +187,7 @@ if env['opencl']:
runtime_files += Glob('src/runtime/CL/functions/*.cpp')
runtime_files += Glob('src/runtime/CL/tuners/*.cpp')
- graph2_files += Glob('src/graph2/backends/CL/*.cpp')
+ graph_files += Glob('src/graph/backends/CL/*.cpp')
if env['neon']:
@@ -202,7 +201,7 @@ if env['neon']:
core_files += Glob('src/core/NEON/kernels/convolution/winograd/*/*.cpp')
arm_compute_env.Append(CPPPATH = ["arm_compute/core/NEON/kernels/winograd/", "arm_compute/core/NEON/kernels/assembly/"])
- graph2_files += Glob('src/graph2/backends/NEON/*.cpp')
+ graph_files += Glob('src/graph/backends/NEON/*.cpp')
if env['arch'] == "armv7a":
core_files += Glob('src/core/NEON/kernels/arm_gemm/kernels/a32_*/*.cpp')
@@ -224,7 +223,7 @@ if env['gles_compute']:
runtime_files += Glob('src/runtime/GLES_COMPUTE/*.cpp')
runtime_files += Glob('src/runtime/GLES_COMPUTE/functions/*.cpp')
- graph2_files += Glob('src/graph2/backends/GLES/*.cpp')
+ graph_files += Glob('src/graph/backends/GLES/*.cpp')
arm_compute_core_a = build_library('arm_compute_core-static', core_files, static=True)
Export('arm_compute_core_a')
@@ -241,38 +240,14 @@ if env['os'] != 'bare_metal' and not env['standalone']:
Depends(arm_compute_so, arm_compute_core_so)
Export('arm_compute_so')
-arm_compute_graph2_a = build_library('arm_compute_graph2-static', graph2_files, static=True, libs = [ arm_compute_a])
-Export('arm_compute_graph2_a')
+arm_compute_graph_a = build_library('arm_compute_graph-static', graph_files, static=True, libs = [ arm_compute_a])
+Export('arm_compute_graph_a')
if env['os'] != 'bare_metal' and not env['standalone']:
- arm_compute_graph2_so = build_library('arm_compute_graph2', graph2_files, static=False, libs = [ "arm_compute" , "arm_compute_core"])
- Depends(arm_compute_graph2_so, arm_compute_so)
- Export('arm_compute_graph2_so')
-
-if env['neon'] and env['opencl']:
- Import('opencl')
- graph_files = Glob('src/graph/*.cpp')
- graph_files += Glob('src/graph/nodes/*.cpp')
- graph_files += Glob('src/graph/operations/*.cpp')
-
- graph_files += Glob('src/graph/CL/*.cpp')
- graph_files += Glob('src/graph/NEON/*.cpp')
-
- shared_graph_objects = [arm_compute_env.SharedObject(f) for f in graph_files]
- static_graph_objects = [arm_compute_env.StaticObject(f) for f in graph_files]
-
- arm_compute_graph_a = build_library('arm_compute_graph-static', static_graph_objects, static=True, libs = [ arm_compute_a ])
- Export('arm_compute_graph_a')
-
- arm_compute_env.Append(LIBPATH = ["#build/%s/opencl-1.2-stubs" % env['build_dir']])
- arm_compute_graph_so = build_library('arm_compute_graph', shared_graph_objects, static=False, libs = [ "arm_compute", "arm_compute_core"])
+ arm_compute_graph_so = build_library('arm_compute_graph', graph_files, static=False, libs = [ "arm_compute" , "arm_compute_core"])
Depends(arm_compute_graph_so, arm_compute_so)
- Depends(arm_compute_graph_so, opencl)
Export('arm_compute_graph_so')
- graph_alias = arm_compute_env.Alias("arm_compute_graph", [arm_compute_graph_a, arm_compute_graph_so])
- Default(graph_alias)
-
if env['standalone']:
alias = arm_compute_env.Alias("arm_compute", [arm_compute_a])
else:
diff --git a/SConstruct b/SConstruct
index b55075ed4a..a0acb7bf5f 100644
--- a/SConstruct
+++ b/SConstruct
@@ -246,7 +246,6 @@ if env['opencl']:
if env['gles_compute'] and env['os'] != 'android':
env.Append(CPPPATH = ['#/include/linux'])
- env.Append(LIBPATH = ["#build/%s/opengles-3.1-stubs" % env['build_dir']])
SConscript("./opengles-3.1-stubs/SConscript", variant_dir="build/%s/opengles-3.1-stubs" % env['build_dir'], duplicate=0)
SConscript('./SConscript', variant_dir='#build/%s' % env['build_dir'], duplicate=0)
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__ */
diff --git a/docs/00_introduction.dox b/docs/00_introduction.dox
index 555cec5c35..17d1bdea63 100644
--- a/docs/00_introduction.dox
+++ b/docs/00_introduction.dox
@@ -321,13 +321,13 @@ v17.12 Public major release
- @ref CLGEMMLowpQuantizeDownInt32ToUint8ScaleKernel / @ref CLGEMMLowpQuantizeDownInt32ToUint8Scale
- New graph nodes for NEON and OpenCL
- - @ref graph::BranchLayer
- - @ref graph::DepthConvertLayer
- - @ref graph::DepthwiseConvolutionLayer
- - @ref graph::DequantizationLayer
- - @ref graph::FlattenLayer
- - @ref graph::QuantizationLayer
- - @ref graph::ReshapeLayer
+ - graph::BranchLayer
+ - graph::DepthConvertLayer
+ - graph::DepthwiseConvolutionLayer
+ - graph::DequantizationLayer
+ - graph::FlattenLayer
+ - graph::QuantizationLayer
+ - graph::ReshapeLayer
v17.10 Public maintenance release
- Bug fixes:
@@ -632,9 +632,6 @@ For Linux, the library was successfully built and tested using the following Lin
- gcc-linaro-4.9-2016.02-x86_64_aarch64-linux-gnu
- gcc-linaro-6.3.1-2017.02-i686_aarch64-linux-gnu
-@note If you are building with opencl=1 then scons will expect to find libOpenCL.so either in the current directory or in "build" (See the section below if you need a stub OpenCL library to link against)
-@note If you are building with gles_compute=1 then scons will expect to find libEGL.so / libGLESv1_CM.so / libGLESv2.so either in the current directory or in "build" (See the section below if you need a stub OpenCL library to link against)
-
To cross-compile the library in debug mode, with NEON only support, for Linux 32bit:
scons Werror=1 -j8 debug=1 neon=1 opencl=0 os=linux arch=armv7a
@@ -672,7 +669,7 @@ or simply remove the build parameter as build=cross_compile is the default value
The examples get automatically built by scons as part of the build process of the library described above. This section just describes how you can build and link your own application against our library.
-@note The following command lines assume the arm_compute and libOpenCL binaries are present in the current directory or in the system library path. If this is not the case you can specify the location of the pre-built library with the compiler option -L. When building the OpenCL example the commands below assume that the CL headers are located in the include folder where the command is executed.
+@note The following command lines assume the arm_compute binaries are present in the current directory or in the system library path. If this is not the case you can specify the location of the pre-built library with the compiler option -L. When building the OpenCL example the commands below assume that the CL headers are located in the include folder where the command is executed.
To cross compile a NEON example for Linux 32bit:
@@ -686,11 +683,11 @@ To cross compile a NEON example for Linux 64bit:
To cross compile an OpenCL example for Linux 32bit:
- arm-linux-gnueabihf-g++ examples/cl_convolution.cpp utils/Utils.cpp -I. -Iinclude -std=c++11 -mfpu=neon -L. -larm_compute -larm_compute_core -lOpenCL -o cl_convolution -DARM_COMPUTE_CL
+ arm-linux-gnueabihf-g++ examples/cl_convolution.cpp utils/Utils.cpp -I. -Iinclude -std=c++11 -mfpu=neon -L. -larm_compute -larm_compute_core -o cl_convolution -DARM_COMPUTE_CL
To cross compile an OpenCL example for Linux 64bit:
- aarch64-linux-gnu-g++ examples/cl_convolution.cpp utils/Utils.cpp -I. -Iinclude -std=c++11 -L. -larm_compute -larm_compute_core -lOpenCL -o cl_convolution -DARM_COMPUTE_CL
+ aarch64-linux-gnu-g++ examples/cl_convolution.cpp utils/Utils.cpp -I. -Iinclude -std=c++11 -L. -larm_compute -larm_compute_core -o cl_convolution -DARM_COMPUTE_CL
To cross compile a GLES example for Linux 32bit:
@@ -730,7 +727,7 @@ To compile natively (i.e directly on an ARM device) for NEON for Linux 64bit:
To compile natively (i.e directly on an ARM device) for OpenCL for Linux 32bit or Linux 64bit:
- g++ examples/cl_convolution.cpp utils/Utils.cpp -I. -Iinclude -std=c++11 -larm_compute -larm_compute_core -lOpenCL -o cl_convolution -DARM_COMPUTE_CL
+ g++ examples/cl_convolution.cpp utils/Utils.cpp -I. -Iinclude -std=c++11 -larm_compute -larm_compute_core -o cl_convolution -DARM_COMPUTE_CL
To compile natively (i.e directly on an ARM device) for GLES for Linux 32bit or Linux 64bit:
@@ -797,8 +794,6 @@ Here is a guide to <a href="https://developer.android.com/ndk/guides/standalone_
@subsubsection S3_3_1_library How to build the library ?
-@note If you are building with opencl=1 then scons will expect to find libOpenCL.so either in the current directory or in "build" (See the section below if you need a stub OpenCL library to link against)
-
To cross-compile the library in debug mode, with NEON only support, for Android 32bit:
CXX=clang++ CC=clang scons Werror=1 -j8 debug=1 neon=1 opencl=0 os=android arch=armv7a
@@ -815,7 +810,7 @@ To cross-compile the library in asserts mode, with GLES_COMPUTE only support, fo
The examples get automatically built by scons as part of the build process of the library described above. This section just describes how you can build and link your own application against our library.
-@note The following command lines assume the arm_compute and libOpenCL binaries are present in the current directory or in the system library path. If this is not the case you can specify the location of the pre-built library with the compiler option -L. When building the OpenCL example the commands below assume that the CL headers are located in the include folder where the command is executed.
+@note The following command lines assume the arm_compute binaries are present in the current directory or in the system library path. If this is not the case you can specify the location of the pre-built library with the compiler option -L. When building the OpenCL example the commands below assume that the CL headers are located in the include folder where the command is executed.
Once you've got your Android standalone toolchain built and added to your path you can do the following:
@@ -829,9 +824,9 @@ To cross compile a NEON example:
To cross compile an OpenCL example:
#32 bit:
- arm-linux-androideabi-clang++ examples/cl_convolution.cpp utils/Utils.cpp -I. -Iinclude -std=c++11 -larm_compute-static -larm_compute_core-static -L. -o cl_convolution_arm -static-libstdc++ -pie -lOpenCL -DARM_COMPUTE_CL
+ arm-linux-androideabi-clang++ examples/cl_convolution.cpp utils/Utils.cpp -I. -Iinclude -std=c++11 -larm_compute-static -larm_compute_core-static -L. -o cl_convolution_arm -static-libstdc++ -pie -DARM_COMPUTE_CL
#64 bit:
- aarch64-linux-android-clang++ examples/cl_convolution.cpp utils/Utils.cpp -I. -Iinclude -std=c++11 -larm_compute-static -larm_compute_core-static -L. -o cl_convolution_aarch64 -static-libstdc++ -pie -lOpenCL -DARM_COMPUTE_CL
+ aarch64-linux-android-clang++ examples/cl_convolution.cpp utils/Utils.cpp -I. -Iinclude -std=c++11 -larm_compute-static -larm_compute_core-static -L. -o cl_convolution_aarch64 -static-libstdc++ -pie -DARM_COMPUTE_CL
To cross compile a GLES example:
@@ -844,9 +839,9 @@ To cross compile the examples with the Graph API, such as graph_lenet.cpp, you n
(notice the compute library has to be built with both neon and opencl enabled - neon=1 and opencl=1)
#32 bit:
- arm-linux-androideabi-clang++ examples/graph_lenet.cpp utils/Utils.cpp utils/GraphUtils.cpp -I. -Iinclude -std=c++11 -Wl,--whole-archive -larm_compute_graph-static -Wl,--no-whole-archive -larm_compute-static -larm_compute_core-static -L. -o graph_lenet_arm -static-libstdc++ -pie -lOpenCL -DARM_COMPUTE_CL
+ arm-linux-androideabi-clang++ examples/graph_lenet.cpp utils/Utils.cpp utils/GraphUtils.cpp -I. -Iinclude -std=c++11 -Wl,--whole-archive -larm_compute_graph-static -Wl,--no-whole-archive -larm_compute-static -larm_compute_core-static -L. -o graph_lenet_arm -static-libstdc++ -pie -DARM_COMPUTE_CL
#64 bit:
- aarch64-linux-android-clang++ examples/graph_lenet.cpp utils/Utils.cpp utils/GraphUtils.cpp -I. -Iinclude -std=c++11 -Wl,--whole-archive -larm_compute_graph-static -Wl,--no-whole-archive -larm_compute-static -larm_compute_core-static -L. -o graph_lenet_aarch64 -static-libstdc++ -pie -lOpenCL -DARM_COMPUTE_CL
+ aarch64-linux-android-clang++ examples/graph_lenet.cpp utils/Utils.cpp utils/GraphUtils.cpp -I. -Iinclude -std=c++11 -Wl,--whole-archive -larm_compute_graph-static -Wl,--no-whole-archive -larm_compute-static -larm_compute_core-static -L. -o graph_lenet_aarch64 -static-libstdc++ -pie -DARM_COMPUTE_CL
@note Due to some issues in older versions of the Mali OpenCL DDK (<= r13p0), we recommend to link arm_compute statically on Android.
@note When linked statically the arm_compute_graph library currently needs the --whole-archive linker flag in order to work properly
diff --git a/examples/SConscript b/examples/SConscript
index 80bce57316..7f7df3e9aa 100644
--- a/examples/SConscript
+++ b/examples/SConscript
@@ -24,70 +24,57 @@ import os.path
Import('env')
-if env['opencl']:
- Import('opencl')
-
-if env['gles_compute'] and env['os'] != 'android':
- Import('egl')
- Import('glesv2')
-
examples_env = env.Clone()
examples_env.Append(CPPPATH = ["#"])
-examples_env.Append(LIBPATH = ["#build/%s/opencl-1.2-stubs" % env['build_dir']])
# Build examples
utils = examples_env.Object("../utils/Utils.cpp")
if env['os'] in ['android', 'bare_metal'] or env['standalone']:
+ Import('arm_compute_graph_a')
Import('arm_compute_a')
Import('arm_compute_core_a')
arm_compute_libs = [ arm_compute_a, arm_compute_core_a ]
arm_compute_dependency = arm_compute_a
+ graph_dependency = [arm_compute_graph_a]
else:
+ Import('arm_compute_graph_so')
Import('arm_compute_so')
- arm_compute_libs = ["arm_compute", "arm_compute_core"]
+ arm_compute_libs = ["arm_compute_graph", "arm_compute", "arm_compute_core"]
arm_compute_dependency = arm_compute_so
+ graph_dependency = [arm_compute_graph_so]
+
+# Build graph examples
+graph_utils = examples_env.Object("../utils/GraphUtils.cpp")
+for file in Glob("./graph_*.cpp"):
+ example = os.path.basename(os.path.splitext(str(file))[0])
+ prog = None
+ arm_compute_graph_libs = arm_compute_libs
-if env['opencl'] and env['neon']:
- for file in Glob("./neoncl_*.cpp"):
- example = os.path.basename(os.path.splitext(str(file))[0])
- prog = examples_env.Program(example, ["{}.cpp".format(example), utils], CPPDEFINES=['ARM_COMPUTE_CL'], LIBS = arm_compute_libs +["OpenCL"])
- Depends(prog, [arm_compute_dependency, opencl])
- alias = examples_env.Alias(example, prog)
- Default(alias)
if env['os'] == 'android':
- Import('arm_compute_graph2_a')
- Import('arm_compute_graph_a')
- Import('arm_compute_core_a')
- Import('arm_compute_a')
- arm_compute_graph_libs = [ arm_compute_a, arm_compute_core_a, "OpenCL"]
- graph_dependency = [arm_compute_graph_a, arm_compute_graph2_a]
+ prog = examples_env.Program(example, ["{}.cpp".format(example), utils, graph_utils], LIBS = arm_compute_graph_libs, LINKFLAGS=examples_env["LINKFLAGS"]+['-Wl,--whole-archive',graph_dependency,'-Wl,--no-whole-archive'])
+ Depends(prog, graph_dependency)
else:
- Import('arm_compute_graph2_so')
- Import('arm_compute_graph_so')
- arm_compute_graph_libs = ["arm_compute_graph2", "arm_compute_graph", "arm_compute", "arm_compute_core"]
- graph_dependency = [arm_compute_graph_so, arm_compute_graph2_so]
+ #-Wl,--allow-shlib-undefined: Ignore dependencies of dependencies
+ prog = examples_env.Program(example, ["{}.cpp".format(example), utils, graph_utils], LIBS = arm_compute_graph_libs, LINKFLAGS=examples_env["LINKFLAGS"]+['-Wl,--allow-shlib-undefined'] )
+ Depends(prog, graph_dependency)
+ alias = examples_env.Alias(example, prog)
+ Default(alias)
- graph_utils = examples_env.Object("../utils/GraphUtils.cpp")
- for file in Glob("./graph_*.cpp"):
+if env['opencl'] and env['neon']:
+ for file in Glob("./neoncl_*.cpp"):
example = os.path.basename(os.path.splitext(str(file))[0])
- prog = None
- if env['os'] == 'android':
- prog = examples_env.Program(example, ["{}.cpp".format(example), utils, graph_utils], LIBS = arm_compute_graph_libs + ["OpenCL"], LINKFLAGS=examples_env["LINKFLAGS"]+['-Wl,--whole-archive',graph_dependency,'-Wl,--no-whole-archive'])
- Depends(prog, [graph_dependency, opencl])
- else:
- #-Wl,--allow-shlib-undefined: Ignore dependencies of dependencies
- prog = examples_env.Program(example, ["{}.cpp".format(example), utils, graph_utils], LIBS = arm_compute_graph_libs, LINKFLAGS=examples_env["LINKFLAGS"]+['-Wl,--allow-shlib-undefined'] )
- Depends(prog, graph_dependency)
+ prog = examples_env.Program(example, ["{}.cpp".format(example), utils], CPPDEFINES=['ARM_COMPUTE_CL'], LIBS = arm_compute_libs)
+ Depends(prog, arm_compute_dependency)
alias = examples_env.Alias(example, prog)
Default(alias)
if env['opencl']:
for file in Glob("./cl_*.cpp"):
example = os.path.basename(os.path.splitext(str(file))[0])
- prog = examples_env.Program(example, ["{}.cpp".format(example), utils], CPPDEFINES=['ARM_COMPUTE_CL'], LIBS = arm_compute_libs +["OpenCL"])
- Depends(prog, [arm_compute_dependency, opencl])
+ prog = examples_env.Program(example, ["{}.cpp".format(example), utils], CPPDEFINES=['ARM_COMPUTE_CL'], LIBS = arm_compute_libs)
+ Depends(prog, arm_compute_dependency)
alias = examples_env.Alias(example, prog)
Default(alias)
@@ -103,13 +90,13 @@ if env['gles_compute']:
for file in Glob("./gc_*.cpp"):
example = os.path.basename(os.path.splitext(str(file))[0])
if env['os'] != 'android':
- prog = examples_env.Program(example, ["{}.cpp".format(example), utils], CPPDEFINES=['ARM_COMPUTE_GC'], LIBS = [arm_compute_libs, "EGL", "GLESv2"])
- Depends(prog, [arm_compute_dependency, egl, glesv2])
+ prog = examples_env.Program(example, ["{}.cpp".format(example), utils], CPPDEFINES=['ARM_COMPUTE_GC'], LIBS = arm_compute_libs)
+ Depends(prog, arm_compute_dependency)
else:
if env['arch'] != 'armv7a':
- prog = examples_env.Program(example, ["{}.cpp".format(example), utils], CPPDEFINES=['ARM_COMPUTE_GC'], LIBS = [arm_compute_libs, "EGL", "GLESv3"])
+ prog = examples_env.Program(example, ["{}.cpp".format(example), utils], CPPDEFINES=['ARM_COMPUTE_GC'], LIBS = arm_compute_libs)
else:
- prog = examples_env.Program(example, ["{}.cpp".format(example), utils], CPPDEFINES=['ARM_COMPUTE_GC'], LIBS = [arm_compute_libs, "EGL", "GLESv2"])
+ prog = examples_env.Program(example, ["{}.cpp".format(example), utils], CPPDEFINES=['ARM_COMPUTE_GC'], LIBS = arm_compute_libs)
Depends(prog, [arm_compute_dependency])
alias = examples_env.Alias(example, prog)
Default(alias)
diff --git a/examples/graph_alexnet.cpp b/examples/graph_alexnet.cpp
index 418d1ea071..6a3c14b7bb 100644
--- a/examples/graph_alexnet.cpp
+++ b/examples/graph_alexnet.cpp
@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#include "arm_compute/graph2.h"
+#include "arm_compute/graph.h"
#include "support/ToolchainSupport.h"
#include "utils/GraphUtils.h"
#include "utils/Utils.h"
@@ -31,7 +31,7 @@
#include <memory>
using namespace arm_compute::utils;
-using namespace arm_compute::graph2::frontend;
+using namespace arm_compute::graph::frontend;
using namespace arm_compute::graph_utils;
/** Example demonstrating how to implement AlexNet's network using the Compute Library's graph API
@@ -54,7 +54,7 @@ public:
// Set target. 0 (NEON), 1 (OpenCL), 2 (OpenCL with Tuner). By default it is NEON
const int target = argc > 1 ? std::strtol(argv[1], nullptr, 10) : 0;
- Target target_hint = set_target_hint2(target);
+ Target target_hint = set_target_hint(target);
// TODO (geopin01) : Get GPU target somehow and set gemm also for midgard ?
const bool is_gemm_convolution5x5 = (target_hint == Target::NEON);
diff --git a/examples/graph_googlenet.cpp b/examples/graph_googlenet.cpp
index d6e76fdced..6c3fac4af2 100644
--- a/examples/graph_googlenet.cpp
+++ b/examples/graph_googlenet.cpp
@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#include "arm_compute/graph2.h"
+#include "arm_compute/graph.h"
#include "support/ToolchainSupport.h"
#include "utils/GraphUtils.h"
#include "utils/Utils.h"
@@ -30,7 +30,7 @@
#include <tuple>
using namespace arm_compute::utils;
-using namespace arm_compute::graph2::frontend;
+using namespace arm_compute::graph::frontend;
using namespace arm_compute::graph_utils;
/** Example demonstrating how to implement Googlenet's network using the Compute Library's graph API
@@ -53,7 +53,7 @@ public:
// Set target. 0 (NEON), 1 (OpenCL), 2 (OpenCL with Tuner). By default it is NEON
const int target = argc > 1 ? std::strtol(argv[1], nullptr, 10) : 0;
- Target target_hint = set_target_hint2(target);
+ Target target_hint = set_target_hint(target);
ConvolutionMethod convolution_hint = (target_hint == Target::CL) ? ConvolutionMethod::WINOGRAD : ConvolutionMethod::GEMM;
// Parse arguments
diff --git a/examples/graph_inception_v3.cpp b/examples/graph_inception_v3.cpp
index 5f049d0f4a..22e6f6e489 100644
--- a/examples/graph_inception_v3.cpp
+++ b/examples/graph_inception_v3.cpp
@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#include "arm_compute/graph2.h"
+#include "arm_compute/graph.h"
#include "support/ToolchainSupport.h"
#include "utils/GraphUtils.h"
#include "utils/Utils.h"
@@ -30,7 +30,7 @@
#include <tuple>
using namespace arm_compute::utils;
-using namespace arm_compute::graph2::frontend;
+using namespace arm_compute::graph::frontend;
using namespace arm_compute::graph_utils;
/** Example demonstrating how to implement InceptionV3's network using the Compute Library's graph API
@@ -52,7 +52,7 @@ public:
// Set target. 0 (NEON), 1 (OpenCL), 2 (OpenCL with Tuner). By default it is NEON
const int target = argc > 1 ? std::strtol(argv[1], nullptr, 10) : 0;
- Target target_hint = set_target_hint2(target);
+ Target target_hint = set_target_hint(target);
ConvolutionMethod convolution_hint = (target_hint == Target::CL) ? ConvolutionMethod::WINOGRAD : ConvolutionMethod::GEMM;
diff --git a/examples/graph_inception_v4.cpp b/examples/graph_inception_v4.cpp
index 847c5b8250..1f7875176f 100644
--- a/examples/graph_inception_v4.cpp
+++ b/examples/graph_inception_v4.cpp
@@ -21,8 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#include "arm_compute/core/Error.h"
-#include "arm_compute/graph2.h"
+#include "arm_compute/graph.h"
#include "support/ToolchainSupport.h"
#include "utils/GraphUtils.h"
#include "utils/Utils.h"
@@ -31,7 +30,7 @@
#include <tuple>
using namespace arm_compute::utils;
-using namespace arm_compute::graph2::frontend;
+using namespace arm_compute::graph::frontend;
using namespace arm_compute::graph_utils;
/** Example demonstrating how to implement InceptionV4's network using the Compute Library's graph API
@@ -56,7 +55,7 @@ public:
// Set target. 0 (NEON), 1 (OpenCL). By default it is NEON
const int target = argc > 1 ? std::strtol(argv[1], nullptr, 10) : 0;
- Target target_hint = set_target_hint2(target);
+ Target target_hint = set_target_hint(target);
ConvolutionMethod convolution_hint = (target_hint == Target::CL) ? ConvolutionMethod::WINOGRAD : ConvolutionMethod::GEMM;
diff --git a/examples/graph_lenet.cpp b/examples/graph_lenet.cpp
index 3803da9b83..8aca0fa45b 100644
--- a/examples/graph_lenet.cpp
+++ b/examples/graph_lenet.cpp
@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#include "arm_compute/graph2.h"
+#include "arm_compute/graph.h"
#include "support/ToolchainSupport.h"
#include "utils/GraphUtils.h"
@@ -30,7 +30,7 @@
#include <cstdlib>
using namespace arm_compute::utils;
-using namespace arm_compute::graph2::frontend;
+using namespace arm_compute::graph::frontend;
using namespace arm_compute::graph_utils;
/** Example demonstrating how to implement LeNet's network using the Compute Library's graph API
@@ -48,7 +48,7 @@ public:
// Set target. 0 (NEON), 1 (OpenCL), 2 (OpenCL with Tuner). By default it is NEON
const int target = argc > 1 ? std::strtol(argv[1], nullptr, 10) : 0;
- Target target_hint = set_target_hint2(target);
+ Target target_hint = set_target_hint(target);
// Parse arguments
if(argc < 2)
diff --git a/examples/graph_mobilenet.cpp b/examples/graph_mobilenet.cpp
index bd25b927fe..055f289f52 100644
--- a/examples/graph_mobilenet.cpp
+++ b/examples/graph_mobilenet.cpp
@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#include "arm_compute/graph2.h"
+#include "arm_compute/graph.h"
#include "support/ToolchainSupport.h"
#include "utils/GraphUtils.h"
#include "utils/Utils.h"
@@ -29,7 +29,7 @@
#include <cstdlib>
using namespace arm_compute::utils;
-using namespace arm_compute::graph2::frontend;
+using namespace arm_compute::graph::frontend;
using namespace arm_compute::graph_utils;
/** Example demonstrating how to implement MobileNet's network using the Compute Library's graph API
@@ -51,7 +51,7 @@ public:
// Set target. 0 (NEON), 1 (OpenCL), 2 (OpenCL with Tuner). By default it is NEON
const int target = argc > 1 ? std::strtol(argv[1], nullptr, 10) : 0;
- Target target_hint = set_target_hint2(target);
+ Target target_hint = set_target_hint(target);
ConvolutionMethod convolution_hint = ConvolutionMethod::GEMM;
DepthwiseConvolutionMethod depthwise_convolution_hint = DepthwiseConvolutionMethod::OPTIMIZED_3x3;
diff --git a/examples/graph_mobilenet_qasymm8.cpp b/examples/graph_mobilenet_qasymm8.cpp
index 76b13dd851..cb49ffdfb4 100644
--- a/examples/graph_mobilenet_qasymm8.cpp
+++ b/examples/graph_mobilenet_qasymm8.cpp
@@ -21,14 +21,15 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#include "arm_compute/graph/Graph.h"
-#include "arm_compute/graph/Nodes.h"
+#include "arm_compute/graph.h"
#include "support/ToolchainSupport.h"
#include "utils/GraphUtils.h"
#include "utils/Utils.h"
-using namespace arm_compute;
-using namespace arm_compute::graph;
+#include <cstdlib>
+
+using namespace arm_compute::utils;
+using namespace arm_compute::graph::frontend;
using namespace arm_compute::graph_utils;
/** Example demonstrating how to implement QASYMM8 MobileNet's network using the Compute Library's graph API
@@ -36,9 +37,11 @@ using namespace arm_compute::graph_utils;
* @param[in] argc Number of arguments
* @param[in] argv Arguments ( [optional] Target (0 = NEON, 1 = OpenCL, 2 = OpenCL with Tuner), [optional] Path to the weights folder, [optional] npy_input, [optional] labels )
*/
-class GraphMobileNetQASYMM8Example : public utils::Example
+class GraphMobileNetQASYMM8Example : public Example
{
public:
+ //FIXME: Missing quantization info to the tensor descriptor (Giorgio is working on it)
+#if 0
void do_setup(int argc, char **argv) override
{
std::string data_path; /* Path to the trainable data */
@@ -217,6 +220,8 @@ private:
return BranchLayer(std::move(sg));
}
+#endif /* if 0 */
+ Stream graph { 0, "MobileNetV1_QASYMM8" };
};
/** Main program for MobileNetQASYMM8
*
@@ -225,5 +230,5 @@ private:
*/
int main(int argc, char **argv)
{
- return utils::run_example<GraphMobileNetQASYMM8Example>(argc, argv);
+ return arm_compute::utils::run_example<GraphMobileNetQASYMM8Example>(argc, argv);
}
diff --git a/examples/graph_resnet50.cpp b/examples/graph_resnet50.cpp
index ec447de66f..eb74a1aa11 100644
--- a/examples/graph_resnet50.cpp
+++ b/examples/graph_resnet50.cpp
@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#include "arm_compute/graph2.h"
+#include "arm_compute/graph.h"
#include "support/ToolchainSupport.h"
#include "utils/GraphUtils.h"
#include "utils/Utils.h"
@@ -29,7 +29,7 @@
#include <cstdlib>
using namespace arm_compute::utils;
-using namespace arm_compute::graph2::frontend;
+using namespace arm_compute::graph::frontend;
using namespace arm_compute::graph_utils;
/** Example demonstrating how to implement Microsoft's ResNet50 network using the Compute Library's graph API
@@ -53,7 +53,7 @@ public:
// Set target. 0 (NEON), 1 (OpenCL), 2 (OpenCL with Tuner). By default it is NEON
const int target = argc > 1 ? std::strtol(argv[1], nullptr, 10) : 0;
- Target target_hint = set_target_hint2(target);
+ Target target_hint = set_target_hint(target);
ConvolutionMethod convolution_hint = (target_hint == Target::CL) ? ConvolutionMethod::WINOGRAD : ConvolutionMethod::GEMM;
diff --git a/examples/graph_squeezenet.cpp b/examples/graph_squeezenet.cpp
index ddbe6b43ce..32be14305f 100644
--- a/examples/graph_squeezenet.cpp
+++ b/examples/graph_squeezenet.cpp
@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#include "arm_compute/graph2.h"
+#include "arm_compute/graph.h"
#include "support/ToolchainSupport.h"
#include "utils/GraphUtils.h"
#include "utils/Utils.h"
@@ -30,7 +30,7 @@
#include <tuple>
using namespace arm_compute::utils;
-using namespace arm_compute::graph2::frontend;
+using namespace arm_compute::graph::frontend;
using namespace arm_compute::graph_utils;
using namespace arm_compute::logging;
@@ -54,7 +54,7 @@ public:
// Set target. 0 (NEON), 1 (OpenCL), 2 (OpenCL with Tuner). By default it is NEON
const int target = argc > 1 ? std::strtol(argv[1], nullptr, 10) : 0;
- Target target_hint = set_target_hint2(target);
+ Target target_hint = set_target_hint(target);
ConvolutionMethod convolution_hint = (target_hint == Target::CL) ? ConvolutionMethod::WINOGRAD : ConvolutionMethod::GEMM;
diff --git a/examples/graph_squeezenet_v1_1.cpp b/examples/graph_squeezenet_v1_1.cpp
index faab79fcf1..2bdb00d7c2 100644
--- a/examples/graph_squeezenet_v1_1.cpp
+++ b/examples/graph_squeezenet_v1_1.cpp
@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#include "arm_compute/graph2.h"
+#include "arm_compute/graph.h"
#include "support/ToolchainSupport.h"
#include "utils/GraphUtils.h"
#include "utils/Utils.h"
@@ -30,7 +30,7 @@
#include <tuple>
using namespace arm_compute::utils;
-using namespace arm_compute::graph2::frontend;
+using namespace arm_compute::graph::frontend;
using namespace arm_compute::graph_utils;
namespace
@@ -57,7 +57,7 @@ public:
// Set target. 0 (NEON), 1 (OpenCL), 2 (OpenCL with Tuner). By default it is NEON
const int target = argc > 1 ? std::strtol(argv[1], nullptr, 10) : 0;
- Target target_hint = set_target_hint2(target);
+ Target target_hint = set_target_hint(target);
ConvolutionMethod convolution_hint = (target_hint == Target::CL) ? ConvolutionMethod::WINOGRAD : ConvolutionMethod::GEMM;
diff --git a/examples/graph_vgg16.cpp b/examples/graph_vgg16.cpp
index 23742ed771..82be97c316 100644
--- a/examples/graph_vgg16.cpp
+++ b/examples/graph_vgg16.cpp
@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#include "arm_compute/graph2.h"
+#include "arm_compute/graph.h"
#include "support/ToolchainSupport.h"
#include "utils/GraphUtils.h"
#include "utils/Utils.h"
@@ -29,7 +29,7 @@
#include <cstdlib>
using namespace arm_compute::utils;
-using namespace arm_compute::graph2::frontend;
+using namespace arm_compute::graph::frontend;
using namespace arm_compute::graph_utils;
namespace
@@ -66,7 +66,7 @@ public:
// Set target. 0 (NEON), 1 (OpenCL), 2 (OpenCL with Tuner). By default it is NEON
const int target = argc > 1 ? std::strtol(argv[1], nullptr, 10) : 0;
- Target target_hint = set_target_hint2(target);
+ Target target_hint = set_target_hint(target);
// Check if we can use GEMM-based convolutions evaluating if the platform has at least 1.8 GB of available memory
const size_t memory_required = 1932735283L;
diff --git a/examples/graph_vgg19.cpp b/examples/graph_vgg19.cpp
index f282b90630..606b0e0142 100644
--- a/examples/graph_vgg19.cpp
+++ b/examples/graph_vgg19.cpp
@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#include "arm_compute/graph2.h"
+#include "arm_compute/graph.h"
#include "support/ToolchainSupport.h"
#include "utils/GraphUtils.h"
#include "utils/Utils.h"
@@ -29,7 +29,7 @@
#include <cstdlib>
using namespace arm_compute::utils;
-using namespace arm_compute::graph2::frontend;
+using namespace arm_compute::graph::frontend;
using namespace arm_compute::graph_utils;
/** Example demonstrating how to implement VGG19's network using the Compute Library's graph API
@@ -52,7 +52,7 @@ public:
// Set target. 0 (NEON), 1 (OpenCL), 2 (OpenCL with Tuner). By default it is NEON
const int target = argc > 1 ? std::strtol(argv[1], nullptr, 10) : 0;
- Target target_hint = set_target_hint2(target);
+ Target target_hint = set_target_hint(target);
ConvolutionMethod convolution_hint = ConvolutionMethod::DIRECT;
// Parse arguments
diff --git a/opencl-1.2-stubs/SConscript b/opencl-1.2-stubs/SConscript
index dab2e2e7f7..da37282fe8 100644
--- a/opencl-1.2-stubs/SConscript
+++ b/opencl-1.2-stubs/SConscript
@@ -3,5 +3,3 @@ Import("env")
opencl = env.SharedLibrary("OpenCL", "opencl_stubs.c")
alias = Alias("opencl", opencl)
Default(alias)
-
-Export("opencl")
diff --git a/opengles-3.1-stubs/SConscript b/opengles-3.1-stubs/SConscript
index 5d4cb87811..c43c6c4cae 100644
--- a/opengles-3.1-stubs/SConscript
+++ b/opengles-3.1-stubs/SConscript
@@ -3,9 +3,7 @@ Import("env")
egl = env.SharedLibrary("EGL", "EGL.c")
alias = Alias("egl", egl)
Default(alias)
-Export("egl")
glesv2 = env.SharedLibrary("GLESv2", "GLESv2.c")
alias = Alias("glesv2", glesv2)
Default(alias)
-Export("glesv2")
diff --git a/src/core/CL/OpenCL.cpp b/src/core/CL/OpenCL.cpp
index 0ef800f265..a8ed9733ef 100644
--- a/src/core/CL/OpenCL.cpp
+++ b/src/core/CL/OpenCL.cpp
@@ -115,6 +115,8 @@ bool CLSymbols::load(const std::string &library)
LOAD_FUNCTION_PTR(clSVMFree, handle);
LOAD_FUNCTION_PTR(clEnqueueSVMMap, handle);
LOAD_FUNCTION_PTR(clEnqueueSVMUnmap, handle);
+ LOAD_FUNCTION_PTR(clEnqueueMarker, handle);
+ LOAD_FUNCTION_PTR(clWaitForEvents, handle);
#undef LOAD_FUNCTION_PTR
@@ -133,6 +135,36 @@ bool opencl_is_available()
}
} // namespace arm_compute
+cl_int clEnqueueMarker(cl_command_queue command_queue,
+ cl_event *event)
+{
+ arm_compute::CLSymbols::get().load_default();
+ auto func = arm_compute::CLSymbols::get().clEnqueueMarker_ptr;
+ if(func != nullptr)
+ {
+ return func(command_queue, event);
+ }
+ else
+ {
+ return CL_OUT_OF_RESOURCES;
+ }
+}
+
+cl_int clWaitForEvents(cl_uint num_events,
+ const cl_event *event_list)
+{
+ arm_compute::CLSymbols::get().load_default();
+ auto func = arm_compute::CLSymbols::get().clWaitForEvents_ptr;
+ if(func != nullptr)
+ {
+ return func(num_events, event_list);
+ }
+ else
+ {
+ return CL_OUT_OF_RESOURCES;
+ }
+}
+
cl_int clEnqueueSVMMap(cl_command_queue command_queue, cl_bool blocking_map, cl_map_flags flags, void *svm_ptr,
size_t size, cl_uint num_events_in_wait_list, const cl_event *event_wait_list, cl_event *event)
{
diff --git a/src/graph/CL/CLMap.cpp b/src/graph/CL/CLMap.cpp
deleted file mode 100644
index 5289ea9a04..0000000000
--- a/src/graph/CL/CLMap.cpp
+++ /dev/null
@@ -1,43 +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.
- */
-#include "arm_compute/graph/CL/CLMap.h"
-
-#include "arm_compute/core/CL/ICLTensor.h"
-#include "arm_compute/core/Helpers.h"
-#include "arm_compute/core/Validate.h"
-#include "arm_compute/graph/ITensorObject.h"
-#include "arm_compute/runtime/CL/CLScheduler.h"
-
-using namespace arm_compute::graph;
-
-CLMap::CLMap(ITensorObject *tensor, bool blocking)
- : _tensor(dynamic_cast<arm_compute::ICLTensor *>(tensor->tensor())), _blocking(blocking)
-{
- ARM_COMPUTE_ERROR_ON_NULLPTR(_tensor);
-}
-
-void CLMap::run()
-{
- _tensor->map(arm_compute::CLScheduler::get().queue(), _blocking);
-}
diff --git a/src/graph/CL/CLUnmap.cpp b/src/graph/CL/CLUnmap.cpp
deleted file mode 100644
index 31f2f19e9c..0000000000
--- a/src/graph/CL/CLUnmap.cpp
+++ /dev/null
@@ -1,43 +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.
- */
-#include "arm_compute/graph/CL/CLUnmap.h"
-
-#include "arm_compute/core/CL/ICLTensor.h"
-#include "arm_compute/core/Helpers.h"
-#include "arm_compute/core/Validate.h"
-#include "arm_compute/graph/ITensorObject.h"
-#include "arm_compute/runtime/CL/CLScheduler.h"
-
-using namespace arm_compute::graph;
-
-CLUnmap::CLUnmap(ITensorObject *tensor)
- : _tensor(dynamic_cast<arm_compute::ICLTensor *>(tensor->tensor()))
-{
- ARM_COMPUTE_ERROR_ON_NULLPTR(_tensor);
-}
-
-void CLUnmap::run()
-{
- _tensor->unmap(arm_compute::CLScheduler::get().queue());
-}
diff --git a/src/graph/Graph.cpp b/src/graph/Graph.cpp
index 47bd672114..e1ffeed668 100644
--- a/src/graph/Graph.cpp
+++ b/src/graph/Graph.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2018 ARM Limited.
+ * Copyright (c) 2018 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -23,293 +23,205 @@
*/
#include "arm_compute/graph/Graph.h"
-#include "arm_compute/graph/CL/CLMap.h"
-#include "arm_compute/graph/CL/CLUnmap.h"
-#include "arm_compute/graph/INode.h"
-#include "arm_compute/graph/ITensorObject.h"
-#include "arm_compute/graph/Tensor.h"
-#include "arm_compute/runtime/CL/CLScheduler.h"
-#include "arm_compute/runtime/CL/CLTensor.h"
-#include "arm_compute/runtime/CL/CLTuner.h"
-#include "arm_compute/runtime/Tensor.h"
-#include "support/ToolchainSupport.h"
-
-#include <sys/stat.h>
-
-using namespace arm_compute::graph;
-
-namespace
+namespace arm_compute
{
-bool file_exists(const std::string &filename)
+namespace graph
{
- std::ifstream file(filename);
- return file.good();
-}
-
-} // namespace
-struct Stage
+Graph::Graph(GraphID id, std::string name)
+ : _id(id), _name(std::move(name)), _nodes(), _edges(), _tensors(), _tagged_nodes(), _mtx()
{
- ITensorObject *_input;
- ITensorObject *_output;
- std::unique_ptr<arm_compute::IFunction> _function;
-};
+}
-struct Graph::Private
-{
-public:
- /** Finalizes the current node's configuration
- *
- * @param _next_hint Device execution hint
- */
- void configure(GraphHints _next_hints);
-
- GraphContext _ctx{};
- std::vector<Stage> _pipeline{};
- std::vector<std::unique_ptr<ITensorObject>> _tensors{};
- std::vector<std::unique_ptr<INode>> _nodes{};
- GraphHints _current_hints{};
- GraphHints _next_hints{};
- std::unique_ptr<ITensorObject> _graph_input{ nullptr };
- std::unique_ptr<ITensorObject> _graph_output{ nullptr };
- std::unique_ptr<INode> _current_node{ nullptr };
- ITensorObject *_current_output{ nullptr };
- bool _info_enabled{ false };
- CLTuner _tuner{};
-
-private:
- ITensorObject *_current_input{ nullptr };
- GraphHints _previous_hints{};
-};
-
-static const std::string tuner_data_filename = "acl_tuner.csv";
-Graph::~Graph() //NOLINT
+bool Graph::remove_node(NodeID nid)
{
- if(_pimpl->_tuner.tune_new_kernels() && !_pimpl->_tuner.lws_table().empty())
+ if(nid >= _nodes.size())
{
- _pimpl->_tuner.save_to_file(tuner_data_filename);
+ return false;
}
-}
-Graph::Graph()
- : _pimpl{ new Private() }
-{
- graph_init();
-}
+ std::unique_ptr<INode> &node = _nodes[nid];
-void Graph::graph_init(const bool use_cl_tuner)
-{
- // Check if OpenCL is available and initialize the scheduler
- if(opencl_is_available())
+ // Remove node connections
+ if(node)
{
- if(_pimpl->_tuner.lws_table().empty() && file_exists(tuner_data_filename))
+ for(auto &input_eid : node->_input_edges)
{
- _pimpl->_tuner.load_from_file(tuner_data_filename);
+ remove_connection(input_eid);
}
- _pimpl->_tuner.set_tune_new_kernels(use_cl_tuner);
- arm_compute::CLScheduler::get().default_init(&_pimpl->_tuner);
- }
-}
-void Graph::run()
-{
- while(true)
- {
- if(_pimpl->_graph_input->has_accessor() && !_pimpl->_graph_input->call_accessor())
+ for(auto &outpud_eid : node->_output_edges)
{
- return;
+ remove_connection(outpud_eid);
}
+ }
- for(auto &stage : _pimpl->_pipeline)
- {
- stage._function->run();
- }
+ node = nullptr;
- if((_pimpl->_graph_output->has_accessor() && !_pimpl->_graph_output->call_accessor())
- || (!_pimpl->_graph_output->has_accessor()))
- {
- return;
- }
- }
+ return true;
}
-//Finalize current node's configuration
-void Graph::Private::configure(GraphHints _next_hints)
+EdgeID Graph::add_connection(NodeID source, size_t source_idx, NodeID sink, size_t sink_idx)
{
- ARM_COMPUTE_ERROR_ON(_current_node == nullptr);
- ARM_COMPUTE_ERROR_ON(_graph_input == nullptr);
+ std::lock_guard<arm_compute::Mutex> lock(_mtx);
- // Is it the first node of the graph ?
- if(_current_input == nullptr)
- {
- _graph_input->set_target(_current_hints.target_hint());
- _current_input = _graph_input.get();
- _previous_hints = _current_hints; // For the first node just assume the previous node was of the same type as this one
- }
+ // Check if node index is valid, if node exists and finally if the connection index is valid
+ ARM_COMPUTE_ERROR_ON((source >= _nodes.size()) || (_nodes[source] == nullptr) || (source_idx >= _nodes[source]->num_outputs()));
+ ARM_COMPUTE_ERROR_ON((sink >= _nodes.size()) || (_nodes[sink] == nullptr) || (sink_idx >= _nodes[sink]->num_inputs()));
- if(_current_node->supports_in_place())
- {
- _current_output = _current_input;
- }
+ // Get nodes
+ std::unique_ptr<INode> &source_node = _nodes[source];
+ std::unique_ptr<INode> &sink_node = _nodes[sink];
- //Automatic output configuration ?
- if(_current_output == nullptr)
+ // Check for duplicate connections (Check only sink node)
+ Edge *sink_node_edge = sink_node->input_edge(sink_idx);
+ if((sink_node_edge != nullptr) && (sink_node_edge->producer_id() == source) && (sink_node_edge->producer_idx() == source_idx)
+ && (sink_node_edge->consumer_id() == sink) && (sink_node_edge->consumer_idx() == sink_idx))
{
- _tensors.push_back(arm_compute::support::cpp14::make_unique<Tensor>(TensorInfo()));
- _current_output = _tensors.back().get();
+ return sink_node_edge->id();
}
- // If either the writer or reader node needs OpenCL then use OpenCL memory:
- if((_next_hints.target_hint() == TargetHint::OPENCL || _current_hints.target_hint() == TargetHint::OPENCL))
+ // Check if there is already a tensor associated with output if not create one
+ TensorID tid = source_node->output_id(source_idx);
+ if(tid == NullTensorID)
{
- _current_output->set_target(TargetHint::OPENCL);
- }
- else
- {
- _current_output->set_target(TargetHint::NEON);
+ tid = create_tensor();
}
+ std::unique_ptr<Tensor> &tensor = _tensors[tid];
+
+ // Create connections
+ EdgeID eid = _edges.size();
+ auto connection = arm_compute::support::cpp14::make_unique<Edge>(eid, source_node.get(), source_idx, sink_node.get(), sink_idx, tensor.get());
+ _edges.push_back(std::move(connection));
+
+ // Add connections to source and sink nodes
+ source_node->_output_edges.insert(eid);
+ sink_node->_input_edges[sink_idx] = eid;
- // Instantiate Node
- _ctx.hints() = _current_hints;
- std::unique_ptr<arm_compute::IFunction> func = _current_node->instantiate_node(_ctx, _current_input, _current_output);
+ // Set tensor output node
+ source_node->_outputs[source_idx] = tid;
+
+ // Bind tensor to the edge
+ tensor->bind_edge(eid);
+
+ // Try and propagate shapes in sink node
+ sink_node->forward_descriptors();
+
+ return eid;
+}
- // If the operation is done in-place, do not allocate or it will prevent following layers from performing the configuration
- if(!_current_node->supports_in_place())
+bool Graph::remove_connection(EdgeID eid)
+{
+ if(eid >= _edges.size())
{
- // Allocate current input
- _current_input->allocate();
+ return false;
}
- // Map input if needed
- if(_current_input->target() == TargetHint::OPENCL)
+ std::unique_ptr<Edge> &edge = _edges[eid];
+
+ // Remove node connections
+ if(edge != nullptr)
{
- if(_previous_hints.target_hint() == TargetHint::NEON)
+ // Get tensor bound to the edge
+ if(edge->tensor() != nullptr)
+ {
+ edge->tensor()->unbind_edge(eid);
+ }
+
+ // Remove edges from source node
+ if(edge->producer() != nullptr)
{
- ARM_COMPUTE_ERROR_ON(_current_hints.target_hint() == TargetHint::NEON);
- _pipeline.push_back({ _current_input, _current_input, arm_compute::support::cpp14::make_unique<CLUnmap>(_current_input) });
+ edge->producer()->_output_edges.erase(eid);
}
- if(_current_hints.target_hint() == TargetHint::NEON)
+
+ // Remove edges from sink node
+ if((edge->consumer() != nullptr) && (edge->consumer_idx() < edge->consumer()->_input_edges.size()))
{
- ARM_COMPUTE_ERROR_ON(_previous_hints.target_hint() == TargetHint::NEON);
- _pipeline.push_back({ _current_input, _current_input, arm_compute::support::cpp14::make_unique<CLMap>(_current_input, true) });
+ edge->consumer()->_input_edges[edge->consumer_idx()] = EmptyEdgeID;
}
}
- _pipeline.push_back({ _current_input, _current_output, std::move(func) });
+ // Clear edge
+ edge = nullptr;
- _current_input = _current_output;
- _current_output = nullptr;
- std::swap(_previous_hints, _current_hints);
- std::swap(_current_hints, _next_hints);
+ return true;
}
-void Graph::add_node(std::unique_ptr<INode> node)
+TensorID Graph::create_tensor(TensorDescriptor desc)
{
- ARM_COMPUTE_ERROR_ON_MSG(_pimpl->_graph_input == nullptr, "The graph's input must be set before the first node is added");
- ARM_COMPUTE_ERROR_ON_MSG(_pimpl->_graph_output != nullptr, "Nothing can be added after the output tensor");
- //Trigger the creation of the current Node:
-
- GraphHints _next_hints = _pimpl->_next_hints;
- _next_hints.set_target_hint(node->override_target_hint(_pimpl->_next_hints.target_hint()));
- ARM_COMPUTE_ERROR_ON(_next_hints.target_hint() == TargetHint::DONT_CARE);
- if(_pimpl->_current_node)
- {
- //Finalize the previous Node:
- _pimpl->configure(_pimpl->_next_hints);
- }
- else
- {
- // If that's the first node then use the same TargetHint before and after the node.
- _pimpl->_current_hints = _next_hints;
- }
- if(_pimpl->_current_node)
- {
- _pimpl->_nodes.push_back(std::move(_pimpl->_current_node));
- }
- _pimpl->_current_node = std::move(node);
+ TensorID tid = _tensors.size();
+ auto tensor = support::cpp14::make_unique<Tensor>(tid, desc);
+ _tensors.push_back(std::move(tensor));
+
+ return tid;
}
-//Add a tensor with an Accessor (i.e either the input or output of the graph)
-void Graph::add_tensor_object(std::unique_ptr<ITensorObject> tensor)
+std::string Graph::name() const
{
- // If it's the first Tensor added then it will be the input of the Graph.
- if(_pimpl->_graph_input == nullptr)
- {
- ARM_COMPUTE_ERROR_ON(_pimpl->_graph_output != nullptr);
- ARM_COMPUTE_ERROR_ON(_pimpl->_current_node != nullptr);
- _pimpl->_graph_input = std::move(tensor);
- }
- else
- {
- // Else it will be the output of the Graph
- ARM_COMPUTE_ERROR_ON(_pimpl->_graph_output != nullptr);
- ARM_COMPUTE_ERROR_ON(_pimpl->_current_node == nullptr);
- _pimpl->_graph_output = std::move(tensor);
- _pimpl->_current_output = _pimpl->_graph_output.get();
-
- // Finalize the graph by configuring the last Node of the graph:
- _pimpl->configure(_pimpl->_current_hints); // Ignore _next_hint as this is the last node, and just use the same hint as before this node.
- _pimpl->_graph_output->allocate();
- }
+ return _name;
}
-bool Graph::opencl_is_available()
+GraphID Graph::id() const
{
- return arm_compute::opencl_is_available();
+ return _id;
}
-arm_compute::GPUTarget Graph::gpu_target()
+const std::vector<NodeID> &Graph::inputs()
{
- // Check if OpenCL is available before returning the GPU target
- if(opencl_is_available())
- {
- return arm_compute::CLScheduler::get().target();
- }
- else
- {
- return GPUTarget::MIDGARD;
- }
+ return _tagged_nodes[NodeType::Input];
+}
+
+std::vector<std::unique_ptr<INode>> &Graph::nodes()
+{
+ return _nodes;
}
-void Graph::set_temp(TensorInfo &&tmp)
+const std::vector<std::unique_ptr<INode>> &Graph::nodes() const
{
- ARM_COMPUTE_ERROR_ON(_pimpl->_graph_input == nullptr);
- ARM_COMPUTE_ERROR_ON(_pimpl->_graph_output != nullptr);
- ARM_COMPUTE_ERROR_ON_MSG(_pimpl->_current_output != nullptr, "TensorInfo for temporary tensor already set");
+ return _nodes;
+}
+
+const std::vector<std::unique_ptr<Edge>> &Graph::edges() const
+{
+ return _edges;
+}
- _pimpl->_tensors.push_back(arm_compute::support::cpp14::make_unique<Tensor>(std::move(tmp)));
- _pimpl->_current_output = _pimpl->_tensors.back().get();
+std::vector<std::unique_ptr<Tensor>> &Graph::tensors()
+{
+ return _tensors;
+}
+
+const std::vector<std::unique_ptr<Tensor>> &Graph::tensors() const
+{
+ return _tensors;
}
-GraphHints &Graph::hints()
+const INode *Graph::node(NodeID id) const
{
- return _pimpl->_next_hints;
+ return (id >= _nodes.size()) ? nullptr : _nodes[id].get();
}
-Graph &arm_compute::graph::operator<<(Graph &graph, TensorInfo &&info)
+INode *Graph::node(NodeID id)
{
- graph.set_temp(std::move(info));
- return graph;
+ return (id >= _nodes.size()) ? nullptr : _nodes[id].get();
}
-Graph &arm_compute::graph::operator<<(Graph &graph, Tensor &&tensor)
+const Edge *Graph::edge(EdgeID id) const
{
- graph.add_tensor_object(arm_compute::support::cpp14::make_unique<Tensor>(std::move(tensor)));
- return graph;
+ return (id >= _edges.size()) ? nullptr : _edges[id].get();
}
-Graph &arm_compute::graph::operator<<(Graph &graph, SubTensor &&sub_tensor)
+Edge *Graph::edge(EdgeID id)
{
- graph.add_tensor_object(arm_compute::support::cpp14::make_unique<SubTensor>(std::move(sub_tensor)));
- return graph;
+ return (id >= _edges.size()) ? nullptr : _edges[id].get();
}
-Graph &arm_compute::graph::operator<<(Graph &graph, TargetHint target_hint)
+const Tensor *Graph::tensor(TensorID id) const
{
- graph.hints().set_target_hint(target_hint);
- return graph;
+ return (id >= _tensors.size()) ? nullptr : _tensors[id].get();
}
-Graph &arm_compute::graph::operator<<(Graph &graph, ConvolutionMethodHint conv_method_hint)
+Tensor *Graph::tensor(TensorID id)
{
- graph.hints().set_convolution_method_hint(conv_method_hint);
- return graph;
+ return (id >= _tensors.size()) ? nullptr : _tensors[id].get();
}
+} // namespace graph
+} // namespace arm_compute \ No newline at end of file
diff --git a/src/graph2/GraphBuilder.cpp b/src/graph/GraphBuilder.cpp
index e6fc2afe21..0d1bdc3596 100644
--- a/src/graph2/GraphBuilder.cpp
+++ b/src/graph/GraphBuilder.cpp
@@ -21,19 +21,19 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#include "arm_compute/graph2/GraphBuilder.h"
+#include "arm_compute/graph/GraphBuilder.h"
-#include "arm_compute/graph2/Graph.h"
-#include "arm_compute/graph2/Utils.h"
-#include "arm_compute/graph2/algorithms/BFS.h"
-#include "arm_compute/graph2/nodes/Nodes.h"
+#include "arm_compute/graph/Graph.h"
+#include "arm_compute/graph/Utils.h"
+#include "arm_compute/graph/algorithms/BFS.h"
+#include "arm_compute/graph/nodes/Nodes.h"
#define CHECK_NODEIDX_PAIR(pair, g) \
ARM_COMPUTE_ERROR_ON(((pair).node_id >= (g).nodes().size()) || ((g).node((pair).node_id) == nullptr) || ((pair).index >= (g).node((pair).node_id)->num_outputs()));
namespace arm_compute
{
-namespace graph2
+namespace graph
{
namespace
{
@@ -390,5 +390,5 @@ NodeID GraphBuilder::add_split_node(Graph &g, NodeParams params, NodeIdxPair inp
{
return create_simple_single_input_output_node<SplitLayerNode>(g, params, input, num_splits, axis);
}
-} // namespace graph2
+} // namespace graph
} // namespace arm_compute \ No newline at end of file
diff --git a/src/graph/GraphContext.cpp b/src/graph/GraphContext.cpp
index bfc6fcdfca..6fc45c0aa7 100644
--- a/src/graph/GraphContext.cpp
+++ b/src/graph/GraphContext.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 ARM Limited.
+ * Copyright (c) 2018 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -22,45 +22,53 @@
* SOFTWARE.
*/
#include "arm_compute/graph/GraphContext.h"
+#include <arm_compute/graph.h>
-using namespace arm_compute::graph;
-
-GraphHints::GraphHints(TargetHint target_hint, ConvolutionMethodHint conv_method_hint)
- : _target_hint(target_hint), _convolution_method_hint(conv_method_hint)
+namespace arm_compute
{
-}
-
-void GraphHints::set_target_hint(TargetHint target_hint)
+namespace graph
{
- _target_hint = target_hint;
-}
-
-void GraphHints::set_convolution_method_hint(ConvolutionMethodHint convolution_method)
+GraphContext::GraphContext()
+ : _config(), _memory_managers()
{
- _convolution_method_hint = convolution_method;
}
-TargetHint GraphHints::target_hint() const
+const GraphConfig &GraphContext::config() const
{
- return _target_hint;
+ return _config;
}
-ConvolutionMethodHint GraphHints::convolution_method_hint() const
+void GraphContext::set_config(const GraphConfig &config)
{
- return _convolution_method_hint;
+ _config = config;
}
-GraphContext::GraphContext()
- : _hints()
+bool GraphContext::insert_memory_management_ctx(MemoryManagerContext &&memory_ctx)
{
+ Target target = memory_ctx.target;
+ if(target == Target::UNSPECIFIED || _memory_managers.find(target) != std::end(_memory_managers))
+ {
+ return false;
+ }
+
+ _memory_managers[target] = std::move(memory_ctx);
+ return true;
}
-GraphHints &GraphContext::hints()
+MemoryManagerContext *GraphContext::memory_management_ctx(Target target)
{
- return _hints;
+ return (_memory_managers.find(target) != std::end(_memory_managers)) ? &_memory_managers[target] : nullptr;
}
-const GraphHints &GraphContext::hints() const
+void GraphContext::finalize()
{
- return _hints;
-} \ No newline at end of file
+ for(auto &mm_obj : _memory_managers)
+ {
+ if(mm_obj.second.mm != nullptr)
+ {
+ mm_obj.second.mm->finalize();
+ }
+ }
+}
+} // namespace graph
+} // namespace arm_compute \ No newline at end of file
diff --git a/src/graph2/GraphManager.cpp b/src/graph/GraphManager.cpp
index a51ba61104..759300e0c9 100644
--- a/src/graph2/GraphManager.cpp
+++ b/src/graph/GraphManager.cpp
@@ -21,18 +21,18 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#include "arm_compute/graph2/GraphManager.h"
+#include "arm_compute/graph/GraphManager.h"
-#include "arm_compute/graph2/Graph.h"
-#include "arm_compute/graph2/GraphContext.h"
-#include "arm_compute/graph2/Logger.h"
-#include "arm_compute/graph2/PassManager.h"
-#include "arm_compute/graph2/Utils.h"
-#include "arm_compute/graph2/detail/ExecutionHelpers.h"
+#include "arm_compute/graph/Graph.h"
+#include "arm_compute/graph/GraphContext.h"
+#include "arm_compute/graph/Logger.h"
+#include "arm_compute/graph/PassManager.h"
+#include "arm_compute/graph/Utils.h"
+#include "arm_compute/graph/detail/ExecutionHelpers.h"
namespace arm_compute
{
-namespace graph2
+namespace graph
{
GraphManager::GraphManager()
: _workloads()
@@ -113,5 +113,5 @@ void GraphManager::invalidate_graph(Graph &graph)
_workloads.erase(it);
}
-} // namespace graph2
+} // namespace graph
} // namespace arm_compute \ No newline at end of file
diff --git a/src/graph/INode.cpp b/src/graph/INode.cpp
index c753f66b43..c1c18e5853 100644
--- a/src/graph/INode.cpp
+++ b/src/graph/INode.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2018 ARM Limited.
+ * Copyright (c) 2018 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -23,33 +23,171 @@
*/
#include "arm_compute/graph/INode.h"
-#include "arm_compute/core/CL/OpenCL.h"
-#include "arm_compute/core/Validate.h"
+#include "arm_compute/core/Error.h"
+#include "arm_compute/graph/Edge.h"
+#include "arm_compute/graph/Graph.h"
+#include "arm_compute/graph/Tensor.h"
-using namespace arm_compute::graph;
+namespace arm_compute
+{
+namespace graph
+{
+// *INDENT-OFF*
+// clang-format off
+INode::INode()
+ : _graph(nullptr), _id(EmptyNodeID), _common_params({ "", Target::UNSPECIFIED}),
+ _outputs(), _input_edges(), _output_edges(), _assigned_target(Target::UNSPECIFIED)
+{
+}
+// clang-format on
+// *INDENT-ON*
-TargetHint INode::override_target_hint(TargetHint target_hint) const
+void INode::set_graph(Graph *g)
{
- if(target_hint == TargetHint::OPENCL && !opencl_is_available())
+ ARM_COMPUTE_ERROR_ON(g == nullptr);
+ _graph = g;
+}
+
+void INode::set_id(NodeID id)
+{
+ _id = id;
+}
+
+void INode::set_common_node_parameters(NodeParams common_params)
+{
+ _common_params = std::move(common_params);
+}
+
+void INode::set_requested_target(Target target)
+{
+ _common_params.target = target;
+}
+
+void INode::set_assigned_target(Target target)
+{
+ _assigned_target = target;
+}
+
+void INode::set_output_tensor(TensorID tid, size_t idx)
+{
+ if(tid != NullTensorID && (idx < _outputs.size()) && (_graph->tensor(tid) != nullptr))
{
- target_hint = TargetHint::DONT_CARE;
+ ARM_COMPUTE_ERROR_ON(_graph == nullptr);
+ Tensor *updated_tensor = _graph->tensor(tid);
+ _outputs[idx] = tid;
+
+ // Set tensor to all output edges of the node
+ for(auto &output_edge_id : _output_edges)
+ {
+ auto output_edge = _graph->edge(output_edge_id);
+ if(output_edge != nullptr)
+ {
+ // Unbind edge from current tensor
+ auto current_output_tensor = output_edge->tensor();
+ current_output_tensor->unbind_edge(output_edge->id());
+
+ // Update tensor to edge and rebind tensor
+ output_edge->update_bound_tensor(updated_tensor);
+ updated_tensor->bind_edge(output_edge->id());
+ }
+ }
}
- GraphHints hints{ target_hint };
- target_hint = node_override_hints(hints).target_hint();
- ARM_COMPUTE_ERROR_ON(target_hint == TargetHint::OPENCL && !opencl_is_available());
- return target_hint;
}
-bool INode::supports_in_place() const
+
+NodeID INode::id() const
+{
+ return _id;
+}
+
+std::string INode::name() const
+{
+ return _common_params.name;
+}
+
+const Graph *INode::graph() const
+{
+ return _graph;
+}
+
+Graph *INode::graph()
+{
+ return _graph;
+}
+
+const std::vector<TensorID> &INode::outputs() const
{
- return _supports_in_place;
+ return _outputs;
}
-void INode::set_supports_in_place(bool value)
+
+const std::vector<EdgeID> &INode::input_edges() const
+{
+ return _input_edges;
+}
+
+const std::set<EdgeID> &INode::output_edges() const
+{
+ return _output_edges;
+}
+
+TensorID INode::input_id(size_t idx) const
+{
+ ARM_COMPUTE_ERROR_ON(idx >= _input_edges.size());
+ Edge *e = _graph->edge(_input_edges[idx]);
+ return (e != nullptr) ? e->tensor_id() : NullTensorID;
+}
+
+TensorID INode::output_id(size_t idx) const
+{
+ ARM_COMPUTE_ERROR_ON(idx >= _outputs.size());
+ return _outputs[idx];
+}
+
+Tensor *INode::input(size_t idx) const
+{
+ ARM_COMPUTE_ERROR_ON(_graph == nullptr);
+ ARM_COMPUTE_ERROR_ON(idx >= _input_edges.size());
+ Edge *e = _graph->edge(_input_edges[idx]);
+ return (e != nullptr) ? e->tensor() : nullptr;
+}
+
+Tensor *INode::output(size_t idx) const
{
- _supports_in_place = value;
+ ARM_COMPUTE_ERROR_ON(_graph == nullptr);
+ ARM_COMPUTE_ERROR_ON(idx >= _outputs.size());
+ return _graph->tensor(_outputs[idx]);
}
-GraphHints INode::node_override_hints(GraphHints hints) const
+
+EdgeID INode::input_edge_id(size_t idx) const
+{
+ ARM_COMPUTE_ERROR_ON(idx >= _input_edges.size());
+ return _input_edges[idx];
+}
+
+Edge *INode::input_edge(size_t idx) const
+{
+ ARM_COMPUTE_ERROR_ON(_graph == nullptr);
+ ARM_COMPUTE_ERROR_ON(idx >= _input_edges.size());
+ return _graph->edge(_input_edges[idx]);
+}
+
+size_t INode::num_inputs() const
+{
+ return _input_edges.size();
+}
+
+size_t INode::num_outputs() const
+{
+ return _outputs.size();
+}
+
+Target INode::requested_target() const
+{
+ return _common_params.target;
+}
+
+Target INode::assigned_target() const
{
- TargetHint target_hint = hints.target_hint();
- hints.set_target_hint((target_hint == TargetHint::DONT_CARE) ? TargetHint::NEON : target_hint);
- return hints;
+ return _assigned_target;
}
+} // namespace graph
+} // namespace arm_compute \ No newline at end of file
diff --git a/src/graph/NodeContext.cpp b/src/graph/NodeContext.cpp
deleted file mode 100644
index 2aa5aa13e8..0000000000
--- a/src/graph/NodeContext.cpp
+++ /dev/null
@@ -1,75 +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.
- */
-#include "arm_compute/graph/NodeContext.h"
-
-using namespace arm_compute::graph;
-
-void NodeContext::set_target(TargetHint target)
-{
- _target = target;
-}
-
-void NodeContext::add_input(arm_compute::ITensor *input)
-{
- ARM_COMPUTE_ERROR_ON(input == nullptr);
- _inputs.emplace_back(input);
-}
-
-void NodeContext::add_output(arm_compute::ITensor *output)
-{
- ARM_COMPUTE_ERROR_ON(output == nullptr);
- _outputs.emplace_back(output);
-}
-
-OperationType NodeContext::operation() const
-{
- return _operation;
-}
-
-TargetHint NodeContext::target() const
-{
- return _target;
-}
-
-arm_compute::ITensor *NodeContext::input(size_t idx) const
-{
- ARM_COMPUTE_ERROR_ON(idx >= _inputs.size());
- return _inputs[idx];
-}
-
-arm_compute::ITensor *NodeContext::output(size_t idx) const
-{
- ARM_COMPUTE_ERROR_ON(idx >= _outputs.size());
- return _outputs[idx];
-}
-
-size_t NodeContext::num_inputs() const
-{
- return _inputs.size();
-}
-
-size_t NodeContext::num_outputs() const
-{
- return _outputs.size();
-} \ No newline at end of file
diff --git a/src/graph/OperationRegistry.cpp b/src/graph/OperationRegistry.cpp
deleted file mode 100644
index 651653f19c..0000000000
--- a/src/graph/OperationRegistry.cpp
+++ /dev/null
@@ -1,61 +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.
- */
-#include "arm_compute/graph/OperationRegistry.h"
-
-using namespace arm_compute::graph;
-
-OperationRegistry::OperationRegistry()
- : _registered_ops()
-{
-}
-
-OperationRegistry &OperationRegistry::get()
-{
- static OperationRegistry instance;
- return instance;
-}
-
-IOperation *OperationRegistry::find_operation(OperationType operation, TargetHint target)
-{
- ARM_COMPUTE_ERROR_ON(!contains(operation, target));
- auto it = std::find_if(_registered_ops[operation].begin(), _registered_ops[operation].end(), [&](const std::unique_ptr<IOperation> &op)
- {
- return (op->target() == target);
- });
- ARM_COMPUTE_ERROR_ON(it == _registered_ops[operation].end());
- return (*it).get();
-}
-
-bool OperationRegistry::contains(OperationType operation, TargetHint target) const
-{
- auto it = _registered_ops.find(operation);
- if(it != _registered_ops.end())
- {
- return std::any_of(it->second.begin(), it->second.end(), [&](const std::unique_ptr<IOperation> &op)
- {
- return (op->target() == target);
- });
- }
- return false;
-}
diff --git a/src/graph2/PassManager.cpp b/src/graph/PassManager.cpp
index 2fa937bd89..8ed68bd99b 100644
--- a/src/graph2/PassManager.cpp
+++ b/src/graph/PassManager.cpp
@@ -21,13 +21,13 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#include "arm_compute/graph2/PassManager.h"
+#include "arm_compute/graph/PassManager.h"
-#include "arm_compute/graph2/Logger.h"
+#include "arm_compute/graph/Logger.h"
namespace arm_compute
{
-namespace graph2
+namespace graph
{
PassManager::PassManager()
: _passes()
@@ -84,5 +84,5 @@ void PassManager::run(Graph &g, size_t index)
pass->mutate(g);
}
}
-} // namespace graph2
+} // namespace graph
} // namespace arm_compute \ No newline at end of file
diff --git a/src/graph/SubGraph.cpp b/src/graph/SubGraph.cpp
deleted file mode 100644
index b1cbb9cc95..0000000000
--- a/src/graph/SubGraph.cpp
+++ /dev/null
@@ -1,110 +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.
- */
-#include "arm_compute/graph/SubGraph.h"
-
-#include "arm_compute/graph/Graph.h"
-#include "arm_compute/graph/INode.h"
-#include "arm_compute/graph/Tensor.h"
-
-using namespace arm_compute::graph;
-
-SubGraph::SubGraph()
- : _nodes(), _input(nullptr), _output(nullptr)
-{
-}
-
-void SubGraph::add_node(std::unique_ptr<INode> node)
-{
- _nodes.push_back(std::move(node));
-}
-
-void SubGraph::add_tensor_object(std::unique_ptr<ITensorObject> tensor)
-{
- // If it's the first Tensor added then it will be the input of the Graph.
- if(_input == nullptr)
- {
- _input = std::move(tensor);
- }
- else
- {
- _output = std::move(tensor);
- }
-}
-
-std::unique_ptr<Graph> SubGraph::construct(const GraphContext &ctx, std::unique_ptr<ITensorObject> input, std::unique_ptr<ITensorObject> output)
-{
- auto graph = arm_compute::support::cpp14::make_unique<Graph>();
-
- // Set hint
- // TODO(geopin01): store hints of sub-graph
- graph->hints() = ctx.hints();
-
- // Configure input
- if(_input == nullptr)
- {
- _input = std::move(input);
- }
- graph->add_tensor_object(std::move(_input));
-
- // Make sure first and last nodes of the subgraph always do operations out-of-place
- _nodes.front()->set_supports_in_place(false);
- _nodes.back()->set_supports_in_place(false);
-
- // Construct nodes
- for(auto &node : _nodes)
- {
- graph->add_node(std::move(node));
- }
-
- // Configure output
- if(_output == nullptr)
- {
- _output = std::move(output);
- }
- graph->add_tensor_object(std::move(_output));
-
- return graph;
-}
-
-bool SubGraph::has_input() const
-{
- return _input != nullptr;
-}
-
-bool SubGraph::has_output() const
-{
- return _output != nullptr;
-}
-
-SubGraph &arm_compute::graph::operator<<(SubGraph &graph, Tensor &&tensor)
-{
- graph.add_tensor_object(arm_compute::support::cpp14::make_unique<Tensor>(std::move(tensor)));
- return graph;
-}
-
-SubGraph &arm_compute::graph::operator<<(SubGraph &graph, SubTensor &&sub_tensor)
-{
- graph.add_tensor_object(arm_compute::support::cpp14::make_unique<SubTensor>(std::move(sub_tensor)));
- return graph;
-}
diff --git a/src/graph/SubTensor.cpp b/src/graph/SubTensor.cpp
deleted file mode 100644
index 2e640dd93c..0000000000
--- a/src/graph/SubTensor.cpp
+++ /dev/null
@@ -1,119 +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.
- */
-#include "arm_compute/graph/SubTensor.h"
-
-#include "arm_compute/core/Error.h"
-#include "arm_compute/core/Helpers.h"
-#include "arm_compute/core/Validate.h"
-#include "arm_compute/runtime/CL/CLSubTensor.h"
-#include "arm_compute/runtime/CL/CLTensor.h"
-#include "arm_compute/runtime/SubTensor.h"
-#include "arm_compute/runtime/Tensor.h"
-#include "utils/TypePrinter.h"
-
-using namespace arm_compute::graph;
-
-namespace
-{
-template <typename SubTensorType, typename ParentTensorType>
-std::unique_ptr<arm_compute::ITensor> initialise_subtensor(arm_compute::ITensor *parent, TensorShape shape, Coordinates coords, bool extend_parent)
-{
- auto ptensor = dynamic_cast<ParentTensorType *>(parent);
- auto subtensor = arm_compute::support::cpp14::make_unique<SubTensorType>(ptensor, shape, coords, extend_parent);
- return std::move(subtensor);
-}
-} // namespace
-
-SubTensor::SubTensor()
- : _target(TargetHint::DONT_CARE), _tensor_shape(), _coords(), _parent(nullptr), _subtensor(nullptr), _extend_parent(false)
-{
-}
-
-SubTensor::SubTensor(Tensor &parent, TensorShape tensor_shape, Coordinates coords, bool extend_parent)
- : _target(TargetHint::DONT_CARE), _tensor_shape(tensor_shape), _coords(coords), _parent(nullptr), _subtensor(nullptr), _extend_parent(extend_parent)
-{
- ARM_COMPUTE_ERROR_ON(parent.tensor() == nullptr);
- _parent = parent.tensor();
- _target = parent.target();
-
- instantiate_subtensor();
-}
-
-SubTensor::SubTensor(arm_compute::ITensor *parent, TensorShape tensor_shape, Coordinates coords, TargetHint target, bool extend_parent)
- : _target(target), _tensor_shape(tensor_shape), _coords(coords), _parent(parent), _subtensor(nullptr), _extend_parent(extend_parent)
-{
- ARM_COMPUTE_ERROR_ON(parent == nullptr);
- instantiate_subtensor();
-}
-
-bool SubTensor::call_accessor()
-{
- return true;
-}
-
-bool SubTensor::has_accessor() const
-{
- return false;
-}
-
-arm_compute::ITensor *SubTensor::set_target(TargetHint target)
-{
- ARM_COMPUTE_ERROR_ON(target != _target);
- return (target == _target) ? _subtensor.get() : nullptr;
-}
-
-arm_compute::ITensor *SubTensor::tensor()
-{
- return _subtensor.get();
-}
-
-const arm_compute::ITensor *SubTensor::tensor() const
-{
- return _subtensor.get();
-}
-
-TargetHint SubTensor::target() const
-{
- return _target;
-}
-
-void SubTensor::allocate()
-{
- // NOP for sub-tensors
-}
-
-void SubTensor::instantiate_subtensor()
-{
- switch(_target)
- {
- case TargetHint::OPENCL:
- _subtensor = initialise_subtensor<arm_compute::CLSubTensor, arm_compute::ICLTensor>(_parent, _tensor_shape, _coords, _extend_parent);
- break;
- case TargetHint::NEON:
- _subtensor = initialise_subtensor<arm_compute::SubTensor, arm_compute::ITensor>(_parent, _tensor_shape, _coords, _extend_parent);
- break;
- default:
- ARM_COMPUTE_ERROR("Invalid TargetHint");
- }
-}
diff --git a/src/graph/Tensor.cpp b/src/graph/Tensor.cpp
index 4db79e93ad..47fb5c65bc 100644
--- a/src/graph/Tensor.cpp
+++ b/src/graph/Tensor.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 ARM Limited.
+ * Copyright (c) 2018 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -23,138 +23,89 @@
*/
#include "arm_compute/graph/Tensor.h"
-#include "arm_compute/core/Error.h"
-#include "arm_compute/core/Helpers.h"
-#include "arm_compute/core/Validate.h"
-#include "arm_compute/runtime/CL/CLTensor.h"
-#include "arm_compute/runtime/Tensor.h"
-#include "utils/TypePrinter.h"
-
-using namespace arm_compute::graph;
-
-namespace
+namespace arm_compute
{
-template <typename TensorType>
-std::unique_ptr<arm_compute::ITensor> initialise_tensor(TensorInfo &info)
+namespace graph
{
- auto tensor = arm_compute::support::cpp14::make_unique<TensorType>();
- tensor->allocator()->init(info);
- return std::move(tensor);
-}
-
-template <typename TensorType>
-void tensor_allocate(arm_compute::ITensor &tensor)
+Tensor::Tensor(TensorID id, TensorDescriptor desc)
+ : _id(id), _desc(desc), _handle(nullptr), _accessor(nullptr), _bound_edges()
{
- auto itensor = dynamic_cast<TensorType *>(&tensor);
- ARM_COMPUTE_ERROR_ON_NULLPTR(itensor);
- itensor->allocator()->allocate();
}
-} // namespace
-Tensor::Tensor(TensorInfo &&info)
- : _target(TargetHint::DONT_CARE), _info(info), _accessor(nullptr), _tensor(nullptr)
+TensorID Tensor::id() const
{
+ return _id;
}
-Tensor::Tensor(Tensor &&src) noexcept
- : _target(src._target),
- _info(std::move(src._info)),
- _accessor(std::move(src._accessor)),
- _tensor(std::move(src._tensor))
+TensorDescriptor &Tensor::desc()
{
+ return _desc;
}
-void Tensor::set_info(TensorInfo &&info)
+const TensorDescriptor &Tensor::desc() const
{
- _info = info;
-}
-
-bool Tensor::call_accessor()
-{
- ARM_COMPUTE_ERROR_ON_NULLPTR(_accessor.get());
- auto cl_tensor = dynamic_cast<arm_compute::CLTensor *>(_tensor.get());
- if(cl_tensor != nullptr && cl_tensor->buffer() == nullptr)
- {
- cl_tensor->map();
- }
- bool retval = _accessor->access_tensor(*_tensor);
- if(cl_tensor != nullptr)
- {
- cl_tensor->unmap();
- }
- return retval;
+ return _desc;
}
-bool Tensor::has_accessor() const
+void Tensor::set_handle(std::unique_ptr<ITensorHandle> backend_tensor)
{
- return (_accessor != nullptr);
+ _handle = std::move(backend_tensor);
}
-arm_compute::ITensor *Tensor::tensor()
+ITensorHandle *Tensor::handle()
{
- return _tensor.get();
+ return _handle.get();
}
-const arm_compute::ITensor *Tensor::tensor() const
+void Tensor::set_accessor(std::unique_ptr<ITensorAccessor> accessor)
{
- return _tensor.get();
+ _accessor = std::move(accessor);
}
-const TensorInfo &Tensor::info() const
+ITensorAccessor *Tensor::accessor()
{
- return _info;
+ return _accessor.get();
}
-arm_compute::ITensor *Tensor::set_target(TargetHint target)
+bool Tensor::call_accessor()
{
- if(_tensor != nullptr)
+ // Early exit guard
+ if(!_accessor || !_handle)
{
- ARM_COMPUTE_ERROR_ON(target != _target);
+ return false;
}
- else
+
+ // Map tensor
+ _handle->map(true);
+
+ // Return in case of null backend buffer
+ if(_handle->tensor().buffer() == nullptr)
{
- switch(target)
- {
- case TargetHint::OPENCL:
- _tensor = initialise_tensor<arm_compute::CLTensor>(_info);
- break;
- case TargetHint::NEON:
- _tensor = initialise_tensor<arm_compute::Tensor>(_info);
- break;
- default:
- ARM_COMPUTE_ERROR("Invalid TargetHint");
- }
- _target = target;
+ return false;
}
- return _tensor.get();
+
+ // Call accessor
+ _accessor->access_tensor(_handle->tensor());
+
+ // Unmap tensor
+ _handle->unmap();
+
+ return true;
}
-void Tensor::allocate()
+void Tensor::bind_edge(EdgeID eid)
{
- ARM_COMPUTE_ERROR_ON_NULLPTR(_tensor.get());
- switch(_target)
- {
- case TargetHint::OPENCL:
- tensor_allocate<arm_compute::CLTensor>(*_tensor);
- break;
- case TargetHint::NEON:
- tensor_allocate<arm_compute::Tensor>(*_tensor);
- break;
- default:
- ARM_COMPUTE_ERROR("Invalid TargetHint");
- }
+ _bound_edges.insert(eid);
}
-void Tensor::allocate_and_fill_if_needed()
+void Tensor::unbind_edge(EdgeID eid)
{
- allocate();
- if(_accessor != nullptr)
- {
- call_accessor();
- }
+ _bound_edges.erase(eid);
}
-TargetHint Tensor::target() const
+const std::set<EdgeID> Tensor::bound_edges() const
{
- return _target;
+ return _bound_edges;
}
+} // namespace graph
+} // namespace arm_compute \ No newline at end of file
diff --git a/src/graph2/Utils.cpp b/src/graph/Utils.cpp
index a3e90f43bc..8537bbfb2a 100644
--- a/src/graph2/Utils.cpp
+++ b/src/graph/Utils.cpp
@@ -21,19 +21,19 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#include "arm_compute/graph2/Utils.h"
+#include "arm_compute/graph/Utils.h"
-#include "arm_compute/graph2/GraphContext.h"
-#include "arm_compute/graph2/backends/BackendRegistry.h"
-#include "arm_compute/graph2/mutators/GraphMutators.h"
+#include "arm_compute/graph/GraphContext.h"
+#include "arm_compute/graph/backends/BackendRegistry.h"
+#include "arm_compute/graph/mutators/GraphMutators.h"
namespace arm_compute
{
-namespace graph2
+namespace graph
{
bool is_target_supported(Target target)
{
- return backends::BackendRegistry::get().contains(target);
+ return backends::BackendRegistry::get().contains(target) && backends::BackendRegistry::get().find_backend(target)->is_backend_supported();
}
Target get_default_target()
@@ -100,5 +100,5 @@ void setup_default_graph_context(GraphContext &ctx)
backend.second->setup_backend_context(ctx);
}
}
-} // namespace graph2
+} // namespace graph
} // namespace arm_compute \ No newline at end of file
diff --git a/src/graph2/Workload.cpp b/src/graph/Workload.cpp
index 3fd36fabc7..c53a8a42da 100644
--- a/src/graph2/Workload.cpp
+++ b/src/graph/Workload.cpp
@@ -21,14 +21,14 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#include "arm_compute/graph2/Workload.h"
+#include "arm_compute/graph/Workload.h"
-#include "arm_compute/graph2/INode.h"
-#include "arm_compute/graph2/ITensorHandle.h"
+#include "arm_compute/graph/INode.h"
+#include "arm_compute/graph/ITensorHandle.h"
namespace arm_compute
{
-namespace graph2
+namespace graph
{
void ExecutionTask::operator()()
{
@@ -37,5 +37,5 @@ void ExecutionTask::operator()()
task->run();
}
}
-} // namespace graph2
+} // namespace graph
} // namespace arm_compute \ No newline at end of file
diff --git a/src/graph2/backends/BackendRegistry.cpp b/src/graph/backends/BackendRegistry.cpp
index 5f1218f335..2803322e64 100644
--- a/src/graph2/backends/BackendRegistry.cpp
+++ b/src/graph/backends/BackendRegistry.cpp
@@ -21,13 +21,13 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#include "arm_compute/graph2/backends/BackendRegistry.h"
+#include "arm_compute/graph/backends/BackendRegistry.h"
-using namespace arm_compute::graph2::backends;
+using namespace arm_compute::graph::backends;
namespace arm_compute
{
-namespace graph2
+namespace graph
{
namespace backends
{
@@ -59,5 +59,5 @@ const std::map<Target, std::unique_ptr<IDeviceBackend>> &BackendRegistry::backen
return _registered_backends;
}
} // namespace backends
-} // namespace graph2
+} // namespace graph
} // namespace arm_compute
diff --git a/src/graph2/backends/CL/CLDeviceBackend.cpp b/src/graph/backends/CL/CLDeviceBackend.cpp
index 71566d2f1f..f10eb33a98 100644
--- a/src/graph2/backends/CL/CLDeviceBackend.cpp
+++ b/src/graph/backends/CL/CLDeviceBackend.cpp
@@ -21,18 +21,18 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#include "arm_compute/graph2/backends/CL/CLDeviceBackend.h"
-
-#include "arm_compute/graph2/Graph.h"
-#include "arm_compute/graph2/GraphContext.h"
-#include "arm_compute/graph2/INode.h"
-#include "arm_compute/graph2/Logger.h"
-#include "arm_compute/graph2/Tensor.h"
-#include "arm_compute/graph2/backends/BackendRegistrar.h"
-#include "arm_compute/graph2/backends/CL/CLFunctionFactory.h"
-#include "arm_compute/graph2/backends/CL/CLNodeValidator.h"
-#include "arm_compute/graph2/backends/CL/CLSubTensorHandle.h"
-#include "arm_compute/graph2/backends/CL/CLTensorHandle.h"
+#include "arm_compute/graph/backends/CL/CLDeviceBackend.h"
+
+#include "arm_compute/graph/Graph.h"
+#include "arm_compute/graph/GraphContext.h"
+#include "arm_compute/graph/INode.h"
+#include "arm_compute/graph/Logger.h"
+#include "arm_compute/graph/Tensor.h"
+#include "arm_compute/graph/backends/BackendRegistrar.h"
+#include "arm_compute/graph/backends/CL/CLFunctionFactory.h"
+#include "arm_compute/graph/backends/CL/CLNodeValidator.h"
+#include "arm_compute/graph/backends/CL/CLSubTensorHandle.h"
+#include "arm_compute/graph/backends/CL/CLTensorHandle.h"
#include "arm_compute/core/TensorInfo.h"
#include "arm_compute/runtime/BlobLifetimeManager.h"
@@ -45,7 +45,7 @@
namespace arm_compute
{
-namespace graph2
+namespace graph
{
namespace backends
{
@@ -114,6 +114,11 @@ void CLDeviceBackend::setup_backend_context(GraphContext &ctx)
}
}
+bool CLDeviceBackend::is_backend_supported()
+{
+ return arm_compute::opencl_is_available();
+}
+
std::unique_ptr<ITensorHandle> CLDeviceBackend::create_tensor(const Tensor &tensor)
{
// Get tensor descriptor
@@ -171,5 +176,5 @@ std::shared_ptr<arm_compute::IMemoryManager> CLDeviceBackend::create_memory_mana
return mm;
}
} // namespace backends
-} // namespace graph2
+} // namespace graph
} // namespace arm_compute \ No newline at end of file
diff --git a/src/graph2/backends/CL/CLFunctionsFactory.cpp b/src/graph/backends/CL/CLFunctionsFactory.cpp
index 5a51b19e18..1b448fefd2 100644
--- a/src/graph2/backends/CL/CLFunctionsFactory.cpp
+++ b/src/graph/backends/CL/CLFunctionsFactory.cpp
@@ -21,16 +21,16 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#include "arm_compute/graph2/backends/CL/CLFunctionFactory.h"
+#include "arm_compute/graph/backends/CL/CLFunctionFactory.h"
#include "arm_compute/core/utils/misc/Cast.h"
-#include "arm_compute/graph2/Graph.h"
-#include "arm_compute/graph2/GraphContext.h"
-#include "arm_compute/graph2/Logger.h"
-#include "arm_compute/graph2/TypePrinter.h"
-#include "arm_compute/graph2/Types.h"
-#include "arm_compute/graph2/backends/Utils.h"
-#include "arm_compute/graph2/nodes/Nodes.h"
+#include "arm_compute/graph/Graph.h"
+#include "arm_compute/graph/GraphContext.h"
+#include "arm_compute/graph/Logger.h"
+#include "arm_compute/graph/TypePrinter.h"
+#include "arm_compute/graph/Types.h"
+#include "arm_compute/graph/backends/Utils.h"
+#include "arm_compute/graph/nodes/Nodes.h"
#include "arm_compute/runtime/CL/CLFunctions.h"
#include "support/ToolchainSupport.h"
@@ -39,7 +39,7 @@ using namespace arm_compute::utils::cast;
namespace arm_compute
{
-namespace graph2
+namespace graph
{
namespace backends
{
@@ -51,12 +51,12 @@ namespace
*
* @return Backing tensor if present else nullptr
*/
-arm_compute::ICLTensor *get_backing_tensor(arm_compute::graph2::Tensor *tensor)
+arm_compute::ICLTensor *get_backing_tensor(arm_compute::graph::Tensor *tensor)
{
arm_compute::ICLTensor *backing_tensor = nullptr;
if(tensor != nullptr)
{
- ARM_COMPUTE_ERROR_ON(tensor->desc().target != arm_compute::graph2::Target::CL);
+ ARM_COMPUTE_ERROR_ON(tensor->desc().target != arm_compute::graph::Target::CL);
// Get backing tensor handle
ITensorHandle *tensor_handle = tensor->handle();
// Get backing tensor
@@ -586,5 +586,5 @@ std::unique_ptr<IFunction> CLFunctionFactory::create(INode *node, GraphContext &
}
}
} // namespace backends
-} // namespace graph2
+} // namespace graph
} // namespace arm_compute \ No newline at end of file
diff --git a/src/graph2/backends/CL/CLNodeValidator.cpp b/src/graph/backends/CL/CLNodeValidator.cpp
index 851285630e..c16b2e67df 100644
--- a/src/graph2/backends/CL/CLNodeValidator.cpp
+++ b/src/graph/backends/CL/CLNodeValidator.cpp
@@ -21,10 +21,10 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#include "arm_compute/graph2/backends/CL/CLNodeValidator.h"
+#include "arm_compute/graph/backends/CL/CLNodeValidator.h"
-#include "arm_compute/graph2/backends/ValidateHelpers.h"
-#include "arm_compute/graph2/nodes/Nodes.h"
+#include "arm_compute/graph/backends/ValidateHelpers.h"
+#include "arm_compute/graph/nodes/Nodes.h"
#include "arm_compute/core/utils/misc/Cast.h"
#include "arm_compute/runtime/CL/CLFunctions.h"
@@ -33,7 +33,7 @@ using namespace arm_compute::utils::cast;
namespace arm_compute
{
-namespace graph2
+namespace graph
{
namespace backends
{
@@ -60,5 +60,5 @@ Status CLNodeValidator::validate(INode *node)
}
}
} // namespace backends
-} // namespace graph2
+} // namespace graph
} // namespace arm_compute \ No newline at end of file
diff --git a/src/graph2/backends/CL/CLSubTensorHandle.cpp b/src/graph/backends/CL/CLSubTensorHandle.cpp
index 65a1ba4d5f..a1bc8a1dd3 100644
--- a/src/graph2/backends/CL/CLSubTensorHandle.cpp
+++ b/src/graph/backends/CL/CLSubTensorHandle.cpp
@@ -21,13 +21,13 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#include "arm_compute/graph2/backends/CL/CLSubTensorHandle.h"
+#include "arm_compute/graph/backends/CL/CLSubTensorHandle.h"
#include "arm_compute/core/utils/misc/Cast.h"
namespace arm_compute
{
-namespace graph2
+namespace graph
{
namespace backends
{
@@ -74,5 +74,5 @@ bool CLSubTensorHandle::is_subtensor() const
return true;
}
} // namespace backends
-} // namespace graph2
+} // namespace graph
} // namespace arm_compute \ No newline at end of file
diff --git a/src/graph2/backends/CL/CLTensorHandle.cpp b/src/graph/backends/CL/CLTensorHandle.cpp
index 89678fb280..563c4d9ac6 100644
--- a/src/graph2/backends/CL/CLTensorHandle.cpp
+++ b/src/graph/backends/CL/CLTensorHandle.cpp
@@ -21,11 +21,11 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#include "arm_compute/graph2/backends/CL/CLTensorHandle.h"
+#include "arm_compute/graph/backends/CL/CLTensorHandle.h"
namespace arm_compute
{
-namespace graph2
+namespace graph
{
namespace backends
{
@@ -74,5 +74,5 @@ bool CLTensorHandle::is_subtensor() const
return false;
}
} // namespace backends
-} // namespace graph2
+} // namespace graph
} // namespace arm_compute \ No newline at end of file
diff --git a/src/graph2/backends/GLES/GCDeviceBackend.cpp b/src/graph/backends/GLES/GCDeviceBackend.cpp
index 7dab422a82..8cd9994744 100644
--- a/src/graph2/backends/GLES/GCDeviceBackend.cpp
+++ b/src/graph/backends/GLES/GCDeviceBackend.cpp
@@ -21,17 +21,17 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#include "arm_compute/graph2/backends/GLES/GCDeviceBackend.h"
-
-#include "arm_compute/graph2/Graph.h"
-#include "arm_compute/graph2/GraphContext.h"
-#include "arm_compute/graph2/INode.h"
-#include "arm_compute/graph2/Logger.h"
-#include "arm_compute/graph2/Tensor.h"
-#include "arm_compute/graph2/backends/BackendRegistrar.h"
-#include "arm_compute/graph2/backends/GLES/GCFunctionFactory.h"
-#include "arm_compute/graph2/backends/GLES/GCNodeValidator.h"
-#include "arm_compute/graph2/backends/GLES/GCTensorHandle.h"
+#include "arm_compute/graph/backends/GLES/GCDeviceBackend.h"
+
+#include "arm_compute/graph/Graph.h"
+#include "arm_compute/graph/GraphContext.h"
+#include "arm_compute/graph/INode.h"
+#include "arm_compute/graph/Logger.h"
+#include "arm_compute/graph/Tensor.h"
+#include "arm_compute/graph/backends/BackendRegistrar.h"
+#include "arm_compute/graph/backends/GLES/GCFunctionFactory.h"
+#include "arm_compute/graph/backends/GLES/GCNodeValidator.h"
+#include "arm_compute/graph/backends/GLES/GCTensorHandle.h"
#include "arm_compute/core/TensorInfo.h"
#include "arm_compute/runtime/BlobLifetimeManager.h"
@@ -44,7 +44,7 @@
namespace arm_compute
{
-namespace graph2
+namespace graph
{
namespace backends
{
@@ -75,6 +75,11 @@ void GCDeviceBackend::setup_backend_context(GraphContext &ctx)
}
}
+bool GCDeviceBackend::is_backend_supported()
+{
+ return arm_compute::opengles31_is_available();
+}
+
std::unique_ptr<ITensorHandle> GCDeviceBackend::create_tensor(const Tensor &tensor)
{
// Get tensor descriptor
@@ -129,5 +134,5 @@ std::shared_ptr<arm_compute::IMemoryManager> GCDeviceBackend::create_memory_mana
return mm;
}
} // namespace backends
-} // namespace graph2
+} // namespace graph
} // namespace arm_compute \ No newline at end of file
diff --git a/src/graph2/backends/GLES/GCFunctionsFactory.cpp b/src/graph/backends/GLES/GCFunctionsFactory.cpp
index 24ab2bce37..12e7c042d4 100644
--- a/src/graph2/backends/GLES/GCFunctionsFactory.cpp
+++ b/src/graph/backends/GLES/GCFunctionsFactory.cpp
@@ -21,16 +21,16 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#include "arm_compute/graph2/backends/GLES/GCFunctionFactory.h"
+#include "arm_compute/graph/backends/GLES/GCFunctionFactory.h"
#include "arm_compute/core/utils/misc/Cast.h"
-#include "arm_compute/graph2/Graph.h"
-#include "arm_compute/graph2/GraphContext.h"
-#include "arm_compute/graph2/Logger.h"
-#include "arm_compute/graph2/TypePrinter.h"
-#include "arm_compute/graph2/Types.h"
-#include "arm_compute/graph2/backends/Utils.h"
-#include "arm_compute/graph2/nodes/Nodes.h"
+#include "arm_compute/graph/Graph.h"
+#include "arm_compute/graph/GraphContext.h"
+#include "arm_compute/graph/Logger.h"
+#include "arm_compute/graph/TypePrinter.h"
+#include "arm_compute/graph/Types.h"
+#include "arm_compute/graph/backends/Utils.h"
+#include "arm_compute/graph/nodes/Nodes.h"
#include "arm_compute/runtime/GLES_COMPUTE/GCFunctions.h"
#include "support/ToolchainSupport.h"
@@ -39,7 +39,7 @@ using namespace arm_compute::utils::cast;
namespace arm_compute
{
-namespace graph2
+namespace graph
{
namespace backends
{
@@ -51,12 +51,12 @@ namespace
*
* @return Backing tensor if present else nullptr
*/
-arm_compute::IGCTensor *get_backing_tensor(arm_compute::graph2::Tensor *tensor)
+arm_compute::IGCTensor *get_backing_tensor(arm_compute::graph::Tensor *tensor)
{
arm_compute::IGCTensor *backing_tensor = nullptr;
if(tensor != nullptr)
{
- ARM_COMPUTE_ERROR_ON(tensor->desc().target != arm_compute::graph2::Target::GC);
+ ARM_COMPUTE_ERROR_ON(tensor->desc().target != arm_compute::graph::Target::GC);
// Get backing tensor handle
ITensorHandle *tensor_handle = tensor->handle();
// Get backing tensor
@@ -503,5 +503,5 @@ std::unique_ptr<IFunction> GCFunctionFactory::create(INode *node, GraphContext &
}
}
} // namespace backends
-} // namespace graph2
+} // namespace graph
} // namespace arm_compute \ No newline at end of file
diff --git a/src/graph2/backends/GLES/GCNodeValidator.cpp b/src/graph/backends/GLES/GCNodeValidator.cpp
index b8daae566d..1e89265382 100644
--- a/src/graph2/backends/GLES/GCNodeValidator.cpp
+++ b/src/graph/backends/GLES/GCNodeValidator.cpp
@@ -21,10 +21,10 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#include "arm_compute/graph2/backends/GLES/GCNodeValidator.h"
+#include "arm_compute/graph/backends/GLES/GCNodeValidator.h"
-#include "arm_compute/graph2/backends/ValidateHelpers.h"
-#include "arm_compute/graph2/nodes/Nodes.h"
+#include "arm_compute/graph/backends/ValidateHelpers.h"
+#include "arm_compute/graph/nodes/Nodes.h"
#include "arm_compute/core/utils/misc/Cast.h"
#include "arm_compute/runtime/GLES_COMPUTE/GCFunctions.h"
@@ -33,7 +33,7 @@ using namespace arm_compute::utils::cast;
namespace arm_compute
{
-namespace graph2
+namespace graph
{
namespace backends
{
@@ -118,5 +118,5 @@ Status GCNodeValidator::validate(INode *node)
}
}
} // namespace backends
-} // namespace graph2
+} // namespace graph
} // namespace arm_compute \ No newline at end of file
diff --git a/src/graph2/backends/GLES/GCTensorHandle.cpp b/src/graph/backends/GLES/GCTensorHandle.cpp
index 2165cd2de6..ae7c778130 100644
--- a/src/graph2/backends/GLES/GCTensorHandle.cpp
+++ b/src/graph/backends/GLES/GCTensorHandle.cpp
@@ -21,11 +21,11 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#include "arm_compute/graph2/backends/GLES/GCTensorHandle.h"
+#include "arm_compute/graph/backends/GLES/GCTensorHandle.h"
namespace arm_compute
{
-namespace graph2
+namespace graph
{
namespace backends
{
@@ -74,5 +74,5 @@ bool GCTensorHandle::is_subtensor() const
return false;
}
} // namespace backends
-} // namespace graph2
+} // namespace graph
} // namespace arm_compute \ No newline at end of file
diff --git a/src/graph2/backends/NEON/NEDeviceBackend.cpp b/src/graph/backends/NEON/NEDeviceBackend.cpp
index 6cb507b4f1..87f88dffdf 100644
--- a/src/graph2/backends/NEON/NEDeviceBackend.cpp
+++ b/src/graph/backends/NEON/NEDeviceBackend.cpp
@@ -21,18 +21,18 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#include "arm_compute/graph2/backends/NEON/NEDeviceBackend.h"
-
-#include "arm_compute/graph2/Graph.h"
-#include "arm_compute/graph2/GraphContext.h"
-#include "arm_compute/graph2/INode.h"
-#include "arm_compute/graph2/Logger.h"
-#include "arm_compute/graph2/Tensor.h"
-#include "arm_compute/graph2/backends/BackendRegistrar.h"
-#include "arm_compute/graph2/backends/NEON/NEFunctionFactory.h"
-#include "arm_compute/graph2/backends/NEON/NENodeValidator.h"
-#include "arm_compute/graph2/backends/NEON/NESubTensorHandle.h"
-#include "arm_compute/graph2/backends/NEON/NETensorHandle.h"
+#include "arm_compute/graph/backends/NEON/NEDeviceBackend.h"
+
+#include "arm_compute/graph/Graph.h"
+#include "arm_compute/graph/GraphContext.h"
+#include "arm_compute/graph/INode.h"
+#include "arm_compute/graph/Logger.h"
+#include "arm_compute/graph/Tensor.h"
+#include "arm_compute/graph/backends/BackendRegistrar.h"
+#include "arm_compute/graph/backends/NEON/NEFunctionFactory.h"
+#include "arm_compute/graph/backends/NEON/NENodeValidator.h"
+#include "arm_compute/graph/backends/NEON/NESubTensorHandle.h"
+#include "arm_compute/graph/backends/NEON/NETensorHandle.h"
#include "arm_compute/core/TensorInfo.h"
#include "arm_compute/runtime/Allocator.h"
@@ -46,7 +46,7 @@
namespace arm_compute
{
-namespace graph2
+namespace graph
{
namespace backends
{
@@ -78,6 +78,11 @@ void NEDeviceBackend::setup_backend_context(GraphContext &ctx)
}
}
+bool NEDeviceBackend::is_backend_supported()
+{
+ return true;
+}
+
std::unique_ptr<ITensorHandle> NEDeviceBackend::create_tensor(const Tensor &tensor)
{
// Get tensor descriptor
@@ -137,5 +142,5 @@ std::shared_ptr<arm_compute::IMemoryManager> NEDeviceBackend::create_memory_mana
return mm;
}
} // namespace backends
-} // namespace graph2
+} // namespace graph
} // namespace arm_compute \ No newline at end of file
diff --git a/src/graph2/backends/NEON/NEFunctionFactory.cpp b/src/graph/backends/NEON/NEFunctionFactory.cpp
index 933210377d..228af9ca6f 100644
--- a/src/graph2/backends/NEON/NEFunctionFactory.cpp
+++ b/src/graph/backends/NEON/NEFunctionFactory.cpp
@@ -21,15 +21,15 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#include "arm_compute/graph2/backends/NEON/NEFunctionFactory.h"
+#include "arm_compute/graph/backends/NEON/NEFunctionFactory.h"
#include "arm_compute/core/utils/misc/Cast.h"
-#include "arm_compute/graph2/Graph.h"
-#include "arm_compute/graph2/GraphContext.h"
-#include "arm_compute/graph2/Logger.h"
-#include "arm_compute/graph2/TypePrinter.h"
-#include "arm_compute/graph2/backends/Utils.h"
-#include "arm_compute/graph2/nodes/Nodes.h"
+#include "arm_compute/graph/Graph.h"
+#include "arm_compute/graph/GraphContext.h"
+#include "arm_compute/graph/Logger.h"
+#include "arm_compute/graph/TypePrinter.h"
+#include "arm_compute/graph/backends/Utils.h"
+#include "arm_compute/graph/nodes/Nodes.h"
#include "arm_compute/runtime/NEON/NEFunctions.h"
#include "support/ToolchainSupport.h"
@@ -37,7 +37,7 @@ using namespace arm_compute::utils::cast;
namespace arm_compute
{
-namespace graph2
+namespace graph
{
namespace backends
{
@@ -49,7 +49,7 @@ namespace
*
* @return Backing tensor if present else nullptr
*/
-arm_compute::ITensor *get_backing_tensor(arm_compute::graph2::Tensor *tensor)
+arm_compute::ITensor *get_backing_tensor(arm_compute::graph::Tensor *tensor)
{
return ((tensor == nullptr) || (tensor->handle() == nullptr)) ? nullptr : &tensor->handle()->tensor();
}
@@ -559,5 +559,5 @@ std::unique_ptr<IFunction> NEFunctionFactory::create(INode *node, GraphContext &
}
}
} // namespace backends
-} // namespace graph2
+} // namespace graph
} // namespace arm_compute \ No newline at end of file
diff --git a/src/graph2/backends/NEON/NENodeValidator.cpp b/src/graph/backends/NEON/NENodeValidator.cpp
index 4620f4cd87..074f03580f 100644
--- a/src/graph2/backends/NEON/NENodeValidator.cpp
+++ b/src/graph/backends/NEON/NENodeValidator.cpp
@@ -21,10 +21,10 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#include "arm_compute/graph2/backends/NEON/NENodeValidator.h"
+#include "arm_compute/graph/backends/NEON/NENodeValidator.h"
-#include "arm_compute/graph2/backends/ValidateHelpers.h"
-#include "arm_compute/graph2/nodes/Nodes.h"
+#include "arm_compute/graph/backends/ValidateHelpers.h"
+#include "arm_compute/graph/nodes/Nodes.h"
#include "arm_compute/core/utils/misc/Cast.h"
#include "arm_compute/runtime/NEON/NEFunctions.h"
@@ -33,7 +33,7 @@ using namespace arm_compute::utils::cast;
namespace arm_compute
{
-namespace graph2
+namespace graph
{
namespace backends
{
@@ -61,5 +61,5 @@ Status NENodeValidator::validate(INode *node)
}
}
} // namespace backends
-} // namespace graph2
+} // namespace graph
} // namespace arm_compute \ No newline at end of file
diff --git a/src/graph2/backends/NEON/NESubTensorHandle.cpp b/src/graph/backends/NEON/NESubTensorHandle.cpp
index 1cd15be29c..c48ba6b9d6 100644
--- a/src/graph2/backends/NEON/NESubTensorHandle.cpp
+++ b/src/graph/backends/NEON/NESubTensorHandle.cpp
@@ -21,11 +21,11 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#include "arm_compute/graph2/backends/NEON/NESubTensorHandle.h"
+#include "arm_compute/graph/backends/NEON/NESubTensorHandle.h"
namespace arm_compute
{
-namespace graph2
+namespace graph
{
namespace backends
{
@@ -71,5 +71,5 @@ bool NESubTensorHandle::is_subtensor() const
return true;
}
} // namespace backends
-} // namespace graph2
+} // namespace graph
} // namespace arm_compute \ No newline at end of file
diff --git a/src/graph2/backends/NEON/NETensorHandle.cpp b/src/graph/backends/NEON/NETensorHandle.cpp
index 0b901c3497..8508ac9511 100644
--- a/src/graph2/backends/NEON/NETensorHandle.cpp
+++ b/src/graph/backends/NEON/NETensorHandle.cpp
@@ -21,11 +21,11 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#include "arm_compute/graph2/backends/NEON/NETensorHandle.h"
+#include "arm_compute/graph/backends/NEON/NETensorHandle.h"
namespace arm_compute
{
-namespace graph2
+namespace graph
{
namespace backends
{
@@ -73,5 +73,5 @@ bool NETensorHandle::is_subtensor() const
return false;
}
} // namespace backends
-} // namespace graph2
+} // namespace graph
} // namespace arm_compute \ No newline at end of file
diff --git a/src/graph2/detail/ExecutionHelpers.cpp b/src/graph/detail/ExecutionHelpers.cpp
index 3688d0b0dc..5a50728164 100644
--- a/src/graph2/detail/ExecutionHelpers.cpp
+++ b/src/graph/detail/ExecutionHelpers.cpp
@@ -21,17 +21,17 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#include "arm_compute/graph2/detail/ExecutionHelpers.h"
+#include "arm_compute/graph/detail/ExecutionHelpers.h"
-#include "arm_compute/graph2/Graph.h"
-#include "arm_compute/graph2/GraphContext.h"
-#include "arm_compute/graph2/GraphManager.h"
-#include "arm_compute/graph2/Tensor.h"
-#include "arm_compute/graph2/backends/BackendRegistry.h"
+#include "arm_compute/graph/Graph.h"
+#include "arm_compute/graph/GraphContext.h"
+#include "arm_compute/graph/GraphManager.h"
+#include "arm_compute/graph/Tensor.h"
+#include "arm_compute/graph/backends/BackendRegistry.h"
namespace arm_compute
{
-namespace graph2
+namespace graph
{
namespace detail
{
@@ -195,5 +195,5 @@ void call_all_output_node_accessors(ExecutionWorkload &workload)
}
}
} // namespace detail
-} // namespace graph2
+} // namespace graph
} // namespace arm_compute \ No newline at end of file
diff --git a/src/graph2/frontend/Stream.cpp b/src/graph/frontend/Stream.cpp
index 4e794f28df..96a166c79c 100644
--- a/src/graph2/frontend/Stream.cpp
+++ b/src/graph/frontend/Stream.cpp
@@ -21,14 +21,14 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#include "arm_compute/graph2/frontend/Stream.h"
+#include "arm_compute/graph/frontend/Stream.h"
-#include "arm_compute/graph2/Utils.h"
-#include "arm_compute/graph2/frontend/ILayer.h"
+#include "arm_compute/graph/Utils.h"
+#include "arm_compute/graph/frontend/ILayer.h"
namespace arm_compute
{
-namespace graph2
+namespace graph
{
namespace frontend
{
@@ -65,5 +65,5 @@ Graph &Stream::graph()
return _g;
}
} // namespace frontend
-} // namespace graph2
+} // namespace graph
} // namespace arm_compute \ No newline at end of file
diff --git a/src/graph2/frontend/SubStream.cpp b/src/graph/frontend/SubStream.cpp
index e6fa605ad1..e8bd23a557 100644
--- a/src/graph2/frontend/SubStream.cpp
+++ b/src/graph/frontend/SubStream.cpp
@@ -21,14 +21,14 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#include "arm_compute/graph2/frontend/SubStream.h"
+#include "arm_compute/graph/frontend/SubStream.h"
-#include "arm_compute/graph2/Graph.h"
-#include "arm_compute/graph2/frontend/ILayer.h"
+#include "arm_compute/graph/Graph.h"
+#include "arm_compute/graph/frontend/ILayer.h"
namespace arm_compute
{
-namespace graph2
+namespace graph
{
namespace frontend
{
@@ -55,5 +55,5 @@ Graph &SubStream::graph()
return _s.graph();
}
} // namespace frontend
-} // namespace graph2
+} // namespace graph
} // namespace arm_compute
diff --git a/src/graph2/mutators/DepthConcatSubTensorMutator.cpp b/src/graph/mutators/DepthConcatSubTensorMutator.cpp
index ea3743bf21..c56f4c5106 100644
--- a/src/graph2/mutators/DepthConcatSubTensorMutator.cpp
+++ b/src/graph/mutators/DepthConcatSubTensorMutator.cpp
@@ -21,19 +21,19 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#include "arm_compute/graph2/mutators/DepthConcatSubTensorMutator.h"
+#include "arm_compute/graph/mutators/DepthConcatSubTensorMutator.h"
-#include "arm_compute/graph2/Graph.h"
-#include "arm_compute/graph2/Logger.h"
-#include "arm_compute/graph2/backends/BackendRegistry.h"
-#include "arm_compute/graph2/nodes/DepthConcatenateLayerNode.h"
+#include "arm_compute/graph/Graph.h"
+#include "arm_compute/graph/Logger.h"
+#include "arm_compute/graph/backends/BackendRegistry.h"
+#include "arm_compute/graph/nodes/DepthConcatenateLayerNode.h"
#include "arm_compute/core/utils/misc/Cast.h"
#include "arm_compute/core/utils/misc/Iterable.h"
namespace arm_compute
{
-namespace graph2
+namespace graph
{
const char *DepthConcatSubTensorMutator::name()
{
@@ -82,5 +82,5 @@ void DepthConcatSubTensorMutator::mutate(Graph &g)
}
}
}
-} // namespace graph2
+} // namespace graph
} // namespace arm_compute
diff --git a/src/graph2/mutators/InPlaceOperationMutator.cpp b/src/graph/mutators/InPlaceOperationMutator.cpp
index bb13e98999..bd3f098965 100644
--- a/src/graph2/mutators/InPlaceOperationMutator.cpp
+++ b/src/graph/mutators/InPlaceOperationMutator.cpp
@@ -21,14 +21,14 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#include "arm_compute/graph2/mutators/InPlaceOperationMutator.h"
+#include "arm_compute/graph/mutators/InPlaceOperationMutator.h"
-#include "arm_compute/graph2/Graph.h"
-#include "arm_compute/graph2/Logger.h"
+#include "arm_compute/graph/Graph.h"
+#include "arm_compute/graph/Logger.h"
namespace arm_compute
{
-namespace graph2
+namespace graph
{
const char *InPlaceOperationMutator::name()
{
@@ -59,5 +59,5 @@ void InPlaceOperationMutator::mutate(Graph &g)
}
}
}
-} // namespace graph2
+} // namespace graph
} // namespace arm_compute
diff --git a/src/graph2/mutators/NodeFusionMutator.cpp b/src/graph/mutators/NodeFusionMutator.cpp
index d0ab3e7e6b..2e893c2e07 100644
--- a/src/graph2/mutators/NodeFusionMutator.cpp
+++ b/src/graph/mutators/NodeFusionMutator.cpp
@@ -21,17 +21,17 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#include "arm_compute/graph2/mutators/NodeFusionMutator.h"
+#include "arm_compute/graph/mutators/NodeFusionMutator.h"
-#include "arm_compute/graph2/Graph.h"
-#include "arm_compute/graph2/Logger.h"
-#include "arm_compute/graph2/nodes/Nodes.h"
+#include "arm_compute/graph/Graph.h"
+#include "arm_compute/graph/Logger.h"
+#include "arm_compute/graph/nodes/Nodes.h"
#include "arm_compute/core/utils/misc/Cast.h"
namespace arm_compute
{
-namespace graph2
+namespace graph
{
namespace detail
{
@@ -92,5 +92,5 @@ void NodeFusionMutator::mutate(Graph &g)
{
detail::fuse_batch_norm_with_activation(g);
}
-} // namespace graph2
+} // namespace graph
} // namespace arm_compute
diff --git a/src/graph2/mutators/SplitLayerSubTensorMutator.cpp b/src/graph/mutators/SplitLayerSubTensorMutator.cpp
index 33494ba6bc..179a6c35fb 100644
--- a/src/graph2/mutators/SplitLayerSubTensorMutator.cpp
+++ b/src/graph/mutators/SplitLayerSubTensorMutator.cpp
@@ -21,19 +21,19 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#include "arm_compute/graph2/mutators/SplitLayerSubTensorMutator.h"
+#include "arm_compute/graph/mutators/SplitLayerSubTensorMutator.h"
-#include "arm_compute/graph2/Graph.h"
-#include "arm_compute/graph2/Logger.h"
-#include "arm_compute/graph2/backends/BackendRegistry.h"
-#include "arm_compute/graph2/nodes/SplitLayerNode.h"
+#include "arm_compute/graph/Graph.h"
+#include "arm_compute/graph/Logger.h"
+#include "arm_compute/graph/backends/BackendRegistry.h"
+#include "arm_compute/graph/nodes/SplitLayerNode.h"
#include "arm_compute/core/utils/misc/Cast.h"
#include "arm_compute/core/utils/misc/Iterable.h"
namespace arm_compute
{
-namespace graph2
+namespace graph
{
const char *SplitLayerSubTensorMutator::name()
{
@@ -85,5 +85,5 @@ void SplitLayerSubTensorMutator::mutate(Graph &g)
}
}
}
-} // namespace graph2
+} // namespace graph
} // namespace arm_compute
diff --git a/src/graph/nodes/ActivationLayer.cpp b/src/graph/nodes/ActivationLayer.cpp
deleted file mode 100644
index 546c42a1e5..0000000000
--- a/src/graph/nodes/ActivationLayer.cpp
+++ /dev/null
@@ -1,56 +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.
- */
-#include "arm_compute/graph/nodes/ActivationLayer.h"
-
-#include "arm_compute/graph/Error.h"
-#include "arm_compute/graph/NodeContext.h"
-#include "arm_compute/graph/OperationRegistry.h"
-#include "support/ToolchainSupport.h"
-
-using namespace arm_compute::graph;
-
-ActivationLayer::ActivationLayer(const ActivationLayerInfo activation_info)
- : _activation_info(activation_info)
-{
- set_supports_in_place(true);
-}
-
-std::unique_ptr<arm_compute::IFunction> ActivationLayer::instantiate_node(GraphContext &ctx, ITensorObject *input, ITensorObject *output)
-{
- ARM_COMPUTE_ERROR_ON_UNALLOCATED_TENSOR_OBJECT(input, output);
-
- arm_compute::ITensor *in = input->tensor();
- arm_compute::ITensor *out = output->tensor();
- _target_hint = ctx.hints().target_hint();
-
- // Create node context
- NodeContext node_ctx(OperationType::ActivationLayer);
- node_ctx.set_target(_target_hint);
- node_ctx.add_input(in);
- node_ctx.add_output(out);
- node_ctx.add_parameter<ActivationLayerInfo>("ActivationLayerInfo", _activation_info);
-
- // Get function
- return OperationRegistry::get().find_operation(OperationType::ActivationLayer, _target_hint)->configure(node_ctx);
-}
diff --git a/src/graph2/nodes/ActivationLayerNode.cpp b/src/graph/nodes/ActivationLayerNode.cpp
index c7c36e9bbd..9996d2ce3f 100644
--- a/src/graph2/nodes/ActivationLayerNode.cpp
+++ b/src/graph/nodes/ActivationLayerNode.cpp
@@ -21,14 +21,14 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#include "arm_compute/graph2/nodes/ActivationLayerNode.h"
+#include "arm_compute/graph/nodes/ActivationLayerNode.h"
-#include "arm_compute/graph2/Graph.h"
-#include "arm_compute/graph2/INodeVisitor.h"
+#include "arm_compute/graph/Graph.h"
+#include "arm_compute/graph/INodeVisitor.h"
namespace arm_compute
{
-namespace graph2
+namespace graph
{
ActivationLayerNode::ActivationLayerNode(ActivationLayerInfo info)
: _info(info)
@@ -79,5 +79,5 @@ void ActivationLayerNode::accept(INodeVisitor &v)
{
v.visit(*this);
}
-} // namespace graph2
+} // namespace graph
} // namespace arm_compute \ No newline at end of file
diff --git a/src/graph/nodes/BatchNormalizationLayer.cpp b/src/graph/nodes/BatchNormalizationLayer.cpp
deleted file mode 100644
index 24287ac61a..0000000000
--- a/src/graph/nodes/BatchNormalizationLayer.cpp
+++ /dev/null
@@ -1,105 +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.
- */
-#include "arm_compute/graph/nodes/BatchNormalizationLayer.h"
-
-#include "arm_compute/graph/Error.h"
-#include "arm_compute/graph/NodeContext.h"
-#include "arm_compute/graph/OperationRegistry.h"
-#include "support/ToolchainSupport.h"
-
-using namespace arm_compute::graph;
-
-std::unique_ptr<arm_compute::IFunction> BatchNormalizationLayer::instantiate_node(GraphContext &ctx, ITensorObject *input, ITensorObject *output)
-{
- ARM_COMPUTE_ERROR_ON_UNALLOCATED_TENSOR_OBJECT(input, output);
-
- arm_compute::ITensor *in = input->tensor();
- arm_compute::ITensor *out = output->tensor();
- _target_hint = ctx.hints().target_hint();
-
- unsigned int batch_norm_size = in->info()->dimension(2);
- if(_mean.tensor() == nullptr)
- {
- _mean.set_info(TensorInfo(TensorShape(batch_norm_size), in->info()->num_channels(), in->info()->data_type(), in->info()->fixed_point_position()));
- }
- if(_var.tensor() == nullptr)
- {
- _var.set_info(TensorInfo(TensorShape(batch_norm_size), in->info()->num_channels(), in->info()->data_type(), in->info()->fixed_point_position()));
- }
- if(_beta.tensor() == nullptr)
- {
- _beta.set_info(TensorInfo(TensorShape(batch_norm_size), in->info()->num_channels(), in->info()->data_type(), in->info()->fixed_point_position()));
- }
- if(_gamma.tensor() == nullptr)
- {
- _gamma.set_info(TensorInfo(TensorShape(batch_norm_size), in->info()->num_channels(), in->info()->data_type(), in->info()->fixed_point_position()));
- }
-
- bool mean_is_loaded = _mean.tensor() != nullptr;
- bool var_is_loaded = _var.tensor() != nullptr;
- bool gamma_is_loaded = _gamma.tensor() != nullptr;
- bool beta_is_loaded = _beta.tensor() != nullptr;
-
- // Set mean, var, gamma and beta target
- _mean.set_target(_target_hint);
- _var.set_target(_target_hint);
- _gamma.set_target(_target_hint);
- _beta.set_target(_target_hint);
-
- // Create node context
- NodeContext node_ctx(OperationType::BatchNormalizationLayer);
- node_ctx.set_target(_target_hint);
- node_ctx.add_input(in);
- node_ctx.add_input(_mean.tensor());
- node_ctx.add_input(_var.tensor());
- node_ctx.add_input(_beta.tensor());
- node_ctx.add_input(_gamma.tensor());
- node_ctx.add_output(out);
- node_ctx.add_parameter<float>("epsilon", _epsilon);
- node_ctx.add_parameter<ActivationLayerInfo>("act_info", _act_info);
-
- // Configure operation
- auto func = OperationRegistry::get().find_operation(OperationType::BatchNormalizationLayer, _target_hint)->configure(node_ctx);
-
- // Fill tensors
- if(!mean_is_loaded)
- {
- _mean.allocate_and_fill_if_needed();
- }
- if(!var_is_loaded)
- {
- _var.allocate_and_fill_if_needed();
- }
- if(!gamma_is_loaded)
- {
- _gamma.allocate_and_fill_if_needed();
- }
- if(!beta_is_loaded)
- {
- _beta.allocate_and_fill_if_needed();
- }
-
- // Get function
- return func;
-} \ No newline at end of file
diff --git a/src/graph2/nodes/BatchNormalizationLayerNode.cpp b/src/graph/nodes/BatchNormalizationLayerNode.cpp
index b9f634210c..f7b041c828 100644
--- a/src/graph2/nodes/BatchNormalizationLayerNode.cpp
+++ b/src/graph/nodes/BatchNormalizationLayerNode.cpp
@@ -21,15 +21,15 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#include "arm_compute/graph2/nodes/BatchNormalizationLayerNode.h"
+#include "arm_compute/graph/nodes/BatchNormalizationLayerNode.h"
#include "arm_compute/core/Utils.h"
-#include "arm_compute/graph2/Graph.h"
-#include "arm_compute/graph2/INodeVisitor.h"
+#include "arm_compute/graph/Graph.h"
+#include "arm_compute/graph/INodeVisitor.h"
namespace arm_compute
{
-namespace graph2
+namespace graph
{
BatchNormalizationLayerNode::BatchNormalizationLayerNode(float epsilon, ActivationLayerInfo fused_activation)
: _epsilon(epsilon), _fused_activation(fused_activation)
@@ -90,5 +90,5 @@ void BatchNormalizationLayerNode::accept(INodeVisitor &v)
{
v.visit(*this);
}
-} // namespace graph2
+} // namespace graph
} // namespace arm_compute \ No newline at end of file
diff --git a/src/graph/nodes/BranchLayer.cpp b/src/graph/nodes/BranchLayer.cpp
deleted file mode 100644
index 7a20a565b8..0000000000
--- a/src/graph/nodes/BranchLayer.cpp
+++ /dev/null
@@ -1,130 +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.
- */
-#include "arm_compute/graph/nodes/BranchLayer.h"
-
-#include "arm_compute/graph/Error.h"
-#include "arm_compute/graph/Graph.h"
-#include "arm_compute/graph/SubGraph.h"
-#include "arm_compute/graph/Tensor.h"
-#include "arm_compute/runtime/IFunction.h"
-#include "support/ToolchainSupport.h"
-#include "utils/TypePrinter.h"
-
-#include <memory>
-#include <tuple>
-#include <vector>
-
-using namespace arm_compute::graph;
-
-/** Branch function */
-class BranchFunction final : public arm_compute::IFunction
-{
-public:
- /** Default Constructor */
- BranchFunction()
- : _graphs()
- {
- }
- /** Registers graph to be executed by the branch function
- *
- * @param[in] graph Graph to register
- */
- void register_graph(std::unique_ptr<Graph> graph)
- {
- _graphs.push_back(std::move(graph));
- }
- // Inherited methods overriden:
- void run() override
- {
- for(auto &g : _graphs)
- {
- ARM_COMPUTE_ERROR_ON(g.get() == nullptr);
- g->run();
- }
- }
-
-private:
- std::vector<std::unique_ptr<Graph>> _graphs;
-};
-
-std::unique_ptr<arm_compute::IFunction> BranchLayer::instantiate_node(GraphContext &ctx, ITensorObject *input, ITensorObject *output)
-{
- ARM_COMPUTE_ERROR_ON(_branch_merge_method != BranchMergeMethod::DEPTH_CONCATENATE);
- ARM_COMPUTE_UNUSED(_branch_merge_method);
- ARM_COMPUTE_ERROR_ON_UNALLOCATED_TENSOR_OBJECT(input, output);
-
- // Create branch function
- auto func = arm_compute::support::cpp14::make_unique<BranchFunction>();
-
- // Track output depth
- int depth = 0;
-
- // Constuct all sub-graphs given the input/output
- for(auto &sg : _sub_graphs)
- {
- ARM_COMPUTE_ERROR_ON(sg.get() == nullptr);
-
- // IO buffers
- std::unique_ptr<ITensorObject> in;
- std::unique_ptr<ITensorObject> out;
- SubTensor *out_sub_tensor = nullptr;
-
- // Create input sub-tensor
- if(!sg->has_input())
- {
- ARM_COMPUTE_ERROR_ON(dynamic_cast<Tensor *>(input) == nullptr);
- in = arm_compute::support::cpp14::make_unique<SubTensor>(*dynamic_cast<Tensor *>(input),
- input->tensor()->info()->tensor_shape(),
- Coordinates());
- }
-
- // Create output sub-tensor
- if(!sg->has_output())
- {
- ARM_COMPUTE_ERROR_ON((dynamic_cast<Tensor *>(output) == nullptr) && (dynamic_cast<SubTensor *>(output) == nullptr));
-
- out = arm_compute::support::cpp14::make_unique<SubTensor>(output->tensor(),
- TensorShape(),
- Coordinates(0, 0, depth),
- output->target(),
- true);
- out_sub_tensor = dynamic_cast<SubTensor *>(out.get());
- }
-
- // Construct sub_graph
- auto g = sg->construct(ctx, std::move(in), std::move(out));
-
- // Register graph to function
- func->register_graph(std::move(g));
-
- // Update and track depth
- if(out_sub_tensor != nullptr)
- {
- ARM_COMPUTE_ERROR_ON(out_sub_tensor->tensor() == nullptr);
- depth += out_sub_tensor->tensor()->info()->tensor_shape()[2];
- }
- }
-
- return std::move(func);
-} \ No newline at end of file
diff --git a/src/graph2/nodes/ConstNode.cpp b/src/graph/nodes/ConstNode.cpp
index 5bd6a8180c..631971c98f 100644
--- a/src/graph2/nodes/ConstNode.cpp
+++ b/src/graph/nodes/ConstNode.cpp
@@ -21,14 +21,14 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#include "arm_compute/graph2/nodes/ConstNode.h"
+#include "arm_compute/graph/nodes/ConstNode.h"
-#include "arm_compute/graph2/Graph.h"
-#include "arm_compute/graph2/INodeVisitor.h"
+#include "arm_compute/graph/Graph.h"
+#include "arm_compute/graph/INodeVisitor.h"
namespace arm_compute
{
-namespace graph2
+namespace graph
{
ConstNode::ConstNode(TensorDescriptor desc)
: _desc(desc)
@@ -68,5 +68,5 @@ void ConstNode::accept(INodeVisitor &v)
{
v.visit(*this);
}
-} // namespace graph2
+} // namespace graph
} // namespace arm_compute
diff --git a/src/graph/nodes/ConvolutionLayer.cpp b/src/graph/nodes/ConvolutionLayer.cpp
deleted file mode 100644
index 5b3a84a4ad..0000000000
--- a/src/graph/nodes/ConvolutionLayer.cpp
+++ /dev/null
@@ -1,363 +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.
- */
-#include "arm_compute/graph/nodes/ConvolutionLayer.h"
-
-#include "arm_compute/graph/Error.h"
-#include "arm_compute/runtime/CL/functions/CLConvolutionLayer.h"
-#include "arm_compute/runtime/CL/functions/CLDirectConvolutionLayer.h"
-#include "arm_compute/runtime/CL/functions/CLWinogradConvolutionLayer.h"
-#include "arm_compute/runtime/IFunction.h"
-#include "arm_compute/runtime/NEON/functions/NEConvolutionLayer.h"
-#include "arm_compute/runtime/NEON/functions/NEDirectConvolutionLayer.h"
-#include "arm_compute/runtime/NEON/functions/NEWinogradLayer.h"
-#include "support/ToolchainSupport.h"
-#include "utils/GraphTypePrinter.h"
-#include "utils/TypePrinter.h"
-
-#include <tuple>
-#include <vector>
-
-using namespace arm_compute::graph;
-
-namespace
-{
-/** Calculates the output shaped of the convolution layer
- *
- * @param[in] input_shape Input tensor shape
- * @param[in] weights_shape Weights shape
- * @param[in] conv_info Convolution information (padding, stride, etc.)
- *
- * @return The expected output tensor shape
- */
-TensorShape calculate_convolution_layer_output_shape(const TensorShape &input_shape, const TensorShape &weights_shape, const PadStrideInfo &conv_info)
-{
- unsigned int output_width = 0;
- unsigned int output_height = 0;
-
- // Get output width and height
- std::tie(output_width, output_height) = arm_compute::scaled_dimensions(input_shape.x(), input_shape.y(), weights_shape.x(), weights_shape.y(), conv_info);
-
- // Create output shape
- TensorShape output_shape = input_shape;
- output_shape.set(0, output_width);
- output_shape.set(1, output_height);
- output_shape.set(2, weights_shape[3]);
-
- return output_shape;
-}
-
-// Instantiate GEMM based convolution layer
-template <typename ConvolutionType, typename TensorType, TargetHint target_hint>
-std::unique_ptr<arm_compute::IFunction> instantiate_function(arm_compute::ITensor *input, arm_compute::ITensor *weights, arm_compute::ITensor *biases, arm_compute::ITensor *output,
- const PadStrideInfo &conv_info, const WeightsInfo &weights_info)
-{
- auto conv = arm_compute::support::cpp14::make_unique<ConvolutionType>();
- conv->configure(
- dynamic_cast<TensorType *>(input),
- dynamic_cast<TensorType *>(weights),
- dynamic_cast<TensorType *>(biases),
- dynamic_cast<TensorType *>(output),
- conv_info, weights_info);
- return std::move(conv);
-}
-
-// Instantiate direct convolution layer
-template <typename ConvolutionType, typename TensorType, TargetHint target_hint>
-std::unique_ptr<arm_compute::IFunction> instantiate_direct_function(arm_compute::ITensor *input, arm_compute::ITensor *weights, arm_compute::ITensor *biases, arm_compute::ITensor *output,
- const PadStrideInfo &conv_info)
-{
- auto conv = arm_compute::support::cpp14::make_unique<ConvolutionType>();
- conv->configure(
- dynamic_cast<TensorType *>(input),
- dynamic_cast<TensorType *>(weights),
- dynamic_cast<TensorType *>(biases),
- dynamic_cast<TensorType *>(output),
- conv_info);
- return std::move(conv);
-}
-
-template <TargetHint target_hint>
-std::unique_ptr<arm_compute::IFunction> instantiate(arm_compute::ITensor *input, arm_compute::ITensor *weights, arm_compute::ITensor *biases, arm_compute::ITensor *output,
- const PadStrideInfo &conv_info, const WeightsInfo &weights_info,
- ConvolutionMethodHint conv_method);
-
-template <>
-std::unique_ptr<arm_compute::IFunction> instantiate<TargetHint::OPENCL>(arm_compute::ITensor *input, arm_compute::ITensor *weights, arm_compute::ITensor *biases, arm_compute::ITensor *output,
- const PadStrideInfo &conv_info,
- const WeightsInfo &weights_info,
- ConvolutionMethodHint conv_method)
-{
- if((conv_method == ConvolutionMethodHint::WINOGRAD)
- && arm_compute::CLWinogradConvolutionLayer::validate(input->info(), weights->info(), biases != nullptr ? biases->info() : nullptr, output->info(), conv_info)) // NOLINT
- {
- ARM_COMPUTE_LOG_GRAPH_INFO("Instantiating CLWinogradConvolutionLayer");
- return instantiate_direct_function<arm_compute::CLWinogradConvolutionLayer, arm_compute::ICLTensor, TargetHint::OPENCL>(input, weights, biases, output, conv_info);
- }
- else if((conv_method == ConvolutionMethodHint::DIRECT)
- && arm_compute::CLDirectConvolutionLayer::validate(input->info(), weights->info(), biases != nullptr ? biases->info() : nullptr, output->info(), conv_info)) // NOLINT
- {
- ARM_COMPUTE_LOG_GRAPH_INFO("Instantiating CLDirectConvolutionLayer");
- return instantiate_direct_function<arm_compute::CLDirectConvolutionLayer, arm_compute::ICLTensor, TargetHint::OPENCL>(input, weights, biases, output, conv_info);
- }
- else
- {
- ARM_COMPUTE_LOG_GRAPH_INFO("Instantiating CLConvolutionLayer");
- return instantiate_function<arm_compute::CLConvolutionLayer, arm_compute::ICLTensor, TargetHint::OPENCL>(input, weights, biases, output, conv_info, weights_info);
- }
-}
-
-template <>
-std::unique_ptr<arm_compute::IFunction> instantiate<TargetHint::NEON>(arm_compute::ITensor *input, arm_compute::ITensor *weights, arm_compute::ITensor *biases, arm_compute::ITensor *output,
- const PadStrideInfo &conv_info,
- const WeightsInfo &weights_info,
- ConvolutionMethodHint conv_method)
-{
- const unsigned int kernel_size_x = weights->info()->tensor_shape().x();
- const unsigned int kernel_size_y = weights->info()->tensor_shape().y();
- const unsigned int conv_stride_x = conv_info.stride().first;
- const unsigned int conv_stride_y = conv_info.stride().second;
-
- bool is_square_kernel = (kernel_size_x == kernel_size_y);
- bool has_same_stride = (conv_stride_x == conv_stride_y);
-
- // TODO (COMPID-765) : Winograd should have a validate function
- if(conv_method == ConvolutionMethodHint::WINOGRAD && is_square_kernel && ((kernel_size_x == 3) || (kernel_size_x == 5)) && has_same_stride && (conv_info.stride().first == 1))
- {
- ARM_COMPUTE_LOG_GRAPH_INFO("Instantiating NEWinogradConvolutionLayer");
- return instantiate_direct_function<arm_compute::NEWinogradLayer, arm_compute::ITensor, TargetHint::NEON>(input, weights, biases, output, conv_info);
- }
- else if((conv_method == ConvolutionMethodHint::DIRECT)
- && arm_compute::NEDirectConvolutionLayer::validate(input->info(), weights->info(), biases != nullptr ? biases->info() : nullptr, output->info(), conv_info)) // NOLINT
- {
- ARM_COMPUTE_LOG_GRAPH_INFO("Instantiating NEDirectConvolutionLayer");
- return instantiate_direct_function<arm_compute::NEDirectConvolutionLayer, arm_compute::ITensor, TargetHint::NEON>(input, weights, biases, output, conv_info);
- }
- else
- {
- ARM_COMPUTE_LOG_GRAPH_INFO("Instantiating NEConvolutionLayer");
- return instantiate_function<arm_compute::NEConvolutionLayer, arm_compute::ITensor, TargetHint::NEON>(input, weights, biases, output, conv_info, weights_info);
- }
-}
-} // namespace
-
-/** Grouped Convolution function */
-class GroupedConvolutionFunction final : public arm_compute::IFunction
-{
-public:
- /** Default Constructor */
- GroupedConvolutionFunction() = default;
- /** Default Destructor */
- ~GroupedConvolutionFunction() final = default;
- /** Prevent instances from being copy constructed */
- GroupedConvolutionFunction(const GroupedConvolutionFunction &) = delete;
- /** Prevent instances from being copy assigned */
- GroupedConvolutionFunction &operator=(const GroupedConvolutionFunction &) = delete;
- /** Allow instances to be move constructed */
- GroupedConvolutionFunction(GroupedConvolutionFunction &&) noexcept = default;
- /** Allow instances to be move assigned */
- GroupedConvolutionFunction &operator=(GroupedConvolutionFunction &&) noexcept = default;
- /** Adds a convolution
- *
- * @param convolution Convolution function to add
- */
- void add_convolution_function(std::unique_ptr<IFunction> convolution) // NOLINT
- {
- _convolutions.emplace_back(std::move(convolution));
- }
-
- // Inherited methods overridden:
- void run() override
- {
- for(auto &c : _convolutions)
- {
- c->run();
- }
- }
-
-private:
- std::vector<std::unique_ptr<IFunction>> _convolutions{};
-};
-
-std::unique_ptr<arm_compute::IFunction> ConvolutionLayer::instantiate_node(GraphContext &ctx, ITensorObject *input, ITensorObject *output)
-{
- ARM_COMPUTE_ERROR_ON_UNALLOCATED_TENSOR_OBJECT(input, output);
-
- arm_compute::ITensor *in = input->tensor();
- arm_compute::ITensor *out = output->tensor();
-
- // Set weights and biases info
- if(_weights.tensor() == nullptr)
- {
- TensorInfo info = TensorInfo(TensorShape(_conv_width, _conv_height, in->info()->dimension(2) / _num_groups, _ofm),
- in->info()->num_channels(),
- in->info()->data_type(),
- in->info()->fixed_point_position());
- info.set_quantization_info(_weights_quant_info);
- _weights.set_info(std::move(info));
- }
- if(_biases.has_accessor() && _biases.tensor() == nullptr)
- {
- DataType dt = in->info()->data_type();
- _biases.set_info(TensorInfo(TensorShape(_ofm), in->info()->num_channels(), is_data_type_quantized_asymmetric(dt) ? DataType::S32 : dt, in->info()->fixed_point_position()));
- }
-
- std::unique_ptr<arm_compute::IFunction> func;
- _target_hint = ctx.hints().target_hint();
- const ConvolutionMethodHint conv_method_hint = ctx.hints().convolution_method_hint();
-
- // Check if the weights and biases are loaded
- bool weights_are_loaded = _weights.tensor() != nullptr;
- bool biases_are_loaded = _biases.has_accessor() ? _biases.tensor() != nullptr : true;
-
- // Set bias and weights target
- _weights.set_target(_target_hint);
- if(_biases.has_accessor())
- {
- _biases.set_target(_target_hint);
- }
-
- // Calculate output shape
- TensorShape output_shape = calculate_convolution_layer_output_shape(in->info()->tensor_shape(), _weights.info().tensor_shape(), _conv_info);
-
- // Output auto inizialitation if not yet initialized
- arm_compute::auto_init_if_empty(*out->info(), output_shape, 1, in->info()->data_type(), in->info()->fixed_point_position(),
- (_out_quant_info.empty()) ? in->info()->quantization_info() : _out_quant_info);
-
- // Create appropriate convolution function
- if(_num_groups == 1)
- {
- func = instantiate_convolution(in, out, conv_method_hint);
- }
- else
- {
- func = instantiate_grouped_convolution(in, out, conv_method_hint);
- }
-
- // Fill weights
- if(!weights_are_loaded)
- {
- _weights.allocate_and_fill_if_needed();
- }
- // Fill biases
- if(!biases_are_loaded)
- {
- _biases.allocate_and_fill_if_needed();
- }
-
- ARM_COMPUTE_LOG_GRAPH_INFO(" Data Type: " << in->info()->data_type()
- << " Input Shape: " << in->info()->tensor_shape()
- << " Weights shape: " << _weights.info().tensor_shape()
- << " Biases Shape: " << _biases.info().tensor_shape()
- << " Output Shape: " << out->info()->tensor_shape()
- << " PadStrideInfo: " << _conv_info
- << " Groups: " << _num_groups
- << " WeightsInfo: " << _weights_info
- << std::endl);
-
- return func;
-}
-
-std::unique_ptr<arm_compute::IFunction> ConvolutionLayer::instantiate_convolution(ITensor *input, ITensor *output, ConvolutionMethodHint conv_method_hint)
-{
- std::unique_ptr<arm_compute::IFunction> func;
- if(_target_hint == TargetHint::OPENCL)
- {
- func = instantiate<TargetHint::OPENCL>(input, _weights.tensor(), _biases.tensor(), output, _conv_info, _weights_info, conv_method_hint);
- }
- else
- {
- func = instantiate<TargetHint::NEON>(input, _weights.tensor(), _biases.tensor(), output, _conv_info, _weights_info, conv_method_hint);
- }
- return func;
-}
-
-std::unique_ptr<arm_compute::IFunction> ConvolutionLayer::instantiate_grouped_convolution(ITensor *input, ITensor *output, ConvolutionMethodHint conv_method_hint)
-{
- // Get tensor shapes
- TensorShape input_shape = input->info()->tensor_shape();
- TensorShape output_shape = output->info()->tensor_shape();
- TensorShape weights_shape = _weights.info().tensor_shape();
- TensorShape biases_shape = _biases.info().tensor_shape();
-
- ARM_COMPUTE_ERROR_ON_MSG((input_shape.z() % _num_groups) != 0, "Input depth not multiple of the number of groups!");
- ARM_COMPUTE_ERROR_ON_MSG((output_shape.z() % _num_groups) != 0, "Output depth not multiple of the number of groups!");
- ARM_COMPUTE_ERROR_ON_MSG((weights_shape[3] % _num_groups) != 0, "Number of kernels not multiple of the number of groups!");
- ARM_COMPUTE_ERROR_ON_MSG((biases_shape.x() % _num_groups) != 0, "Biases not multiple of the number of groups!");
-
- // Create a grouped convolution function
- auto grouped_conv = arm_compute::support::cpp14::make_unique<GroupedConvolutionFunction>();
-
- // Create sub-tensors vectors
- _is = arm_compute::support::cpp14::make_unique<SubTensor[]>(_num_groups);
- _os = arm_compute::support::cpp14::make_unique<SubTensor[]>(_num_groups);
- _ws = arm_compute::support::cpp14::make_unique<SubTensor[]>(_num_groups);
- _bs = arm_compute::support::cpp14::make_unique<SubTensor[]>(_num_groups);
-
- // Calculate sub-tensor splits
- const int input_split = input_shape.z() / _num_groups;
- const int output_split = output_shape.z() / _num_groups;
- const int weights_split = weights_shape[3] / _num_groups;
- const int biases_split = biases_shape.x() / _num_groups;
-
- // Calculate sub-tensor shapes
- input_shape.set(2, input_split);
- output_shape.set(2, output_split);
- weights_shape.set(3, weights_split);
- biases_shape.set(0, biases_split);
-
- // Configure sub-tensors
- for(int i = 0; i < static_cast<int>(_num_groups); ++i)
- {
- // Create convolution function
- std::unique_ptr<arm_compute::IFunction> func;
-
- // Calculate sub-tensors starting coordinates
- Coordinates input_coord(0, 0, input_split * i);
- Coordinates output_coord(0, 0, output_split * i);
- Coordinates weights_coord(0, 0, 0, weights_split * i);
- Coordinates biases_coord(biases_split * i);
-
- // Create sub-tensors for input, output, weights and bias
- auto hint_to_use = (_target_hint == TargetHint::OPENCL) ? TargetHint::OPENCL : TargetHint::NEON;
- _is[i] = SubTensor(input, input_shape, input_coord, hint_to_use);
- _os[i] = SubTensor(output, output_shape, output_coord, hint_to_use);
- _ws[i] = SubTensor(_weights.tensor(), weights_shape, weights_coord, hint_to_use);
- _bs[i] = SubTensor(_biases.tensor(), biases_shape, biases_coord, hint_to_use);
-
- // Instantiate convolution function
- if(_target_hint == TargetHint::OPENCL)
- {
- func = instantiate<TargetHint::OPENCL>(_is[i].tensor(), _ws[i].tensor(), _bs[i].tensor(), _os[i].tensor(), _conv_info, _weights_info, conv_method_hint);
- }
- else
- {
- func = instantiate<TargetHint::NEON>(_is[i].tensor(), _ws[i].tensor(), _bs[i].tensor(), _os[i].tensor(), _conv_info, _weights_info, conv_method_hint);
- }
-
- // Add convolution function to the list of convolutions for the grouped convolution
- grouped_conv->add_convolution_function(std::move(func));
- }
-
- return std::move(grouped_conv);
-}
diff --git a/src/graph2/nodes/ConvolutionLayerNode.cpp b/src/graph/nodes/ConvolutionLayerNode.cpp
index 499b3520b2..461728487f 100644
--- a/src/graph2/nodes/ConvolutionLayerNode.cpp
+++ b/src/graph/nodes/ConvolutionLayerNode.cpp
@@ -21,15 +21,15 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#include "arm_compute/graph2/nodes/ConvolutionLayerNode.h"
+#include "arm_compute/graph/nodes/ConvolutionLayerNode.h"
#include "arm_compute/core/Utils.h"
-#include "arm_compute/graph2/Graph.h"
-#include "arm_compute/graph2/INodeVisitor.h"
+#include "arm_compute/graph/Graph.h"
+#include "arm_compute/graph/INodeVisitor.h"
namespace arm_compute
{
-namespace graph2
+namespace graph
{
ConvolutionLayerNode::ConvolutionLayerNode(PadStrideInfo info, ConvolutionMethod method)
: _info(std::move(info)), _method(method)
@@ -107,5 +107,5 @@ void ConvolutionLayerNode::accept(INodeVisitor &v)
{
v.visit(*this);
}
-} // namespace graph2
+} // namespace graph
} // namespace arm_compute \ No newline at end of file
diff --git a/src/graph/nodes/DeQuantizationLayer.cpp b/src/graph/nodes/DeQuantizationLayer.cpp
deleted file mode 100644
index af9ecee157..0000000000
--- a/src/graph/nodes/DeQuantizationLayer.cpp
+++ /dev/null
@@ -1,68 +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.
- */
-#include "arm_compute/graph/nodes/DequantizationLayer.h"
-
-#include "arm_compute/graph/Error.h"
-#include "arm_compute/graph/NodeContext.h"
-#include "arm_compute/graph/OperationRegistry.h"
-
-using namespace arm_compute::graph;
-
-std::unique_ptr<arm_compute::IFunction> DequantizationLayer::instantiate_node(GraphContext &ctx, ITensorObject *input, ITensorObject *output)
-{
- ARM_COMPUTE_ERROR_ON_UNALLOCATED_TENSOR_OBJECT(input, output);
-
- _target_hint = ctx.hints().target_hint();
- arm_compute::ITensor *in = input->tensor();
- arm_compute::ITensor *out = output->tensor();
-
- if(_min_max.tensor() == nullptr)
- {
- TensorShape shape = in->info()->tensor_shape();
- shape.set(Window::DimX, 2);
- shape.remove_dimension(1);
- shape.remove_dimension(1);
-
- _min_max.set_info(TensorInfo(shape, in->info()->num_channels(), DataType::F32));
- _min_max.set_target(_target_hint);
- }
-
- bool minmax_is_loaded = _min_max.tensor() != nullptr;
-
- // Create node context
- NodeContext node_ctx(OperationType::DequantizationLayer);
- node_ctx.set_target(_target_hint);
- node_ctx.add_input(in);
- node_ctx.add_output(_min_max.tensor());
- node_ctx.add_output(out);
-
- // Fill min max
- if(!minmax_is_loaded)
- {
- _min_max.allocate_and_fill_if_needed();
- }
-
- // Get function
- return OperationRegistry::get().find_operation(OperationType::DequantizationLayer, _target_hint)->configure(node_ctx);
-}
diff --git a/src/graph2/nodes/DepthConcatenateLayerNode.cpp b/src/graph/nodes/DepthConcatenateLayerNode.cpp
index dcd66517b6..1c0539744f 100644
--- a/src/graph2/nodes/DepthConcatenateLayerNode.cpp
+++ b/src/graph/nodes/DepthConcatenateLayerNode.cpp
@@ -21,15 +21,15 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#include "arm_compute/graph2/nodes/DepthConcatenateLayerNode.h"
+#include "arm_compute/graph/nodes/DepthConcatenateLayerNode.h"
#include "arm_compute/core/Utils.h"
-#include "arm_compute/graph2/Graph.h"
-#include "arm_compute/graph2/INodeVisitor.h"
+#include "arm_compute/graph/Graph.h"
+#include "arm_compute/graph/INodeVisitor.h"
namespace arm_compute
{
-namespace graph2
+namespace graph
{
DepthConcatenateLayerNode::DepthConcatenateLayerNode(unsigned int total_nodes)
: _total_nodes(total_nodes), _is_enabled(true)
@@ -129,5 +129,5 @@ void DepthConcatenateLayerNode::accept(INodeVisitor &v)
{
v.visit(*this);
}
-} // namespace graph2
+} // namespace graph
} // namespace arm_compute \ No newline at end of file
diff --git a/src/graph/nodes/DepthConvertLayer.cpp b/src/graph/nodes/DepthConvertLayer.cpp
deleted file mode 100644
index 9b328e7b3e..0000000000
--- a/src/graph/nodes/DepthConvertLayer.cpp
+++ /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.
- */
-#include "arm_compute/graph/nodes/DepthConvertLayer.h"
-
-#include "arm_compute/graph/Error.h"
-#include "arm_compute/graph/NodeContext.h"
-#include "arm_compute/graph/OperationRegistry.h"
-
-using namespace arm_compute::graph;
-
-DepthConvertLayer::DepthConvertLayer(const ConvertPolicy policy, uint32_t shift, DataType output_datatype)
- : _policy(policy), _shift(shift), _output_datatype(output_datatype)
-{
-}
-
-std::unique_ptr<arm_compute::IFunction> DepthConvertLayer::instantiate_node(GraphContext &ctx, ITensorObject *input, ITensorObject *output)
-{
- ARM_COMPUTE_ERROR_ON_UNALLOCATED_TENSOR_OBJECT(input, output);
-
- _target_hint = ctx.hints().target_hint();
- arm_compute::ITensor *in = input->tensor();
- arm_compute::ITensor *out = output->tensor();
-
- // Auto configure output
- arm_compute::auto_init_if_empty(*out->info(), in->info()->tensor_shape(), 1, _output_datatype, in->info()->fixed_point_position());
-
- // Create node context
- NodeContext node_ctx(OperationType::DepthConvertLayer);
- node_ctx.set_target(_target_hint);
- node_ctx.add_input(in);
- node_ctx.add_output(out);
- node_ctx.add_parameter<ConvertPolicy>("ConvertPolicy", _policy);
- node_ctx.add_parameter<uint32_t>("shift", _shift);
-
- // Get function
- return OperationRegistry::get().find_operation(OperationType::DepthConvertLayer, _target_hint)->configure(node_ctx);
-}
diff --git a/src/graph/nodes/DepthwiseConvolutionLayer.cpp b/src/graph/nodes/DepthwiseConvolutionLayer.cpp
deleted file mode 100644
index e5101cc33c..0000000000
--- a/src/graph/nodes/DepthwiseConvolutionLayer.cpp
+++ /dev/null
@@ -1,91 +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.
- */
-#include "arm_compute/graph/nodes/DepthwiseConvolutionLayer.h"
-
-#include "arm_compute/graph/Error.h"
-#include "arm_compute/graph/NodeContext.h"
-#include "arm_compute/graph/OperationRegistry.h"
-#include "support/ToolchainSupport.h"
-
-using namespace arm_compute::graph;
-
-std::unique_ptr<arm_compute::IFunction> DepthwiseConvolutionLayer::instantiate_node(GraphContext &ctx, ITensorObject *input, ITensorObject *output)
-{
- ARM_COMPUTE_ERROR_ON_UNALLOCATED_TENSOR_OBJECT(input, output);
-
- arm_compute::ITensor *in = input->tensor();
- arm_compute::ITensor *out = output->tensor();
- _target_hint = ctx.hints().target_hint();
-
- if(_weights.tensor() == nullptr)
- {
- TensorShape weights_shape(_conv_width, _conv_height, input->tensor()->info()->tensor_shape().z());
- TensorInfo info = TensorInfo(TensorShape(weights_shape), in->info()->num_channels(), in->info()->data_type(), in->info()->fixed_point_position());
- info.set_quantization_info(_quant_info);
- _weights.set_info(std::move(info));
- }
- if(_biases.has_accessor() && _biases.tensor() == nullptr)
- {
- DataType dt = in->info()->data_type();
- _biases.set_info(TensorInfo(TensorShape(in->info()->dimension(2)), in->info()->num_channels(), is_data_type_quantized_asymmetric(dt) ? DataType::S32 : dt, in->info()->fixed_point_position()));
- }
-
- bool weights_is_loaded = _weights.tensor() != nullptr;
- bool biases_is_loaded = _biases.has_accessor() ? _biases.tensor() != nullptr : true;
-
- _weights.set_target(_target_hint);
- if(_biases.has_accessor())
- {
- _biases.set_target(_target_hint);
- }
-
- // Create node context
- NodeContext node_ctx(OperationType::DepthwiseConvolutionLayer);
- node_ctx.set_target(_target_hint);
- node_ctx.add_input(in);
- node_ctx.add_input(_weights.tensor());
- if(_biases.has_accessor())
- {
- node_ctx.add_input(_biases.tensor());
- }
- node_ctx.add_output(out);
- node_ctx.add_parameter<PadStrideInfo>("ConvolutionInfo", _conv_info);
- node_ctx.add_parameter<bool>("Optimized3x3", _opt3x3);
-
- // Configure operation
- auto func = OperationRegistry::get().find_operation(OperationType::DepthwiseConvolutionLayer, _target_hint)->configure(node_ctx);
-
- // Fill tensors
- if(!weights_is_loaded)
- {
- _weights.allocate_and_fill_if_needed();
- }
- if(!biases_is_loaded)
- {
- _biases.allocate_and_fill_if_needed();
- }
-
- // Get function
- return func;
-}
diff --git a/src/graph2/nodes/DepthwiseConvolutionLayerNode.cpp b/src/graph/nodes/DepthwiseConvolutionLayerNode.cpp
index b030e8b7ca..67a39029e6 100644
--- a/src/graph2/nodes/DepthwiseConvolutionLayerNode.cpp
+++ b/src/graph/nodes/DepthwiseConvolutionLayerNode.cpp
@@ -21,15 +21,15 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#include "arm_compute/graph2/nodes/DepthwiseConvolutionLayerNode.h"
+#include "arm_compute/graph/nodes/DepthwiseConvolutionLayerNode.h"
#include "arm_compute/core/Utils.h"
-#include "arm_compute/graph2/Graph.h"
-#include "arm_compute/graph2/INodeVisitor.h"
+#include "arm_compute/graph/Graph.h"
+#include "arm_compute/graph/INodeVisitor.h"
namespace arm_compute
{
-namespace graph2
+namespace graph
{
DepthwiseConvolutionLayerNode::DepthwiseConvolutionLayerNode(PadStrideInfo info, DepthwiseConvolutionMethod method)
: _info(std::move(info)), _method(method)
@@ -106,5 +106,5 @@ void DepthwiseConvolutionLayerNode::accept(INodeVisitor &v)
{
v.visit(*this);
}
-} // namespace graph2
+} // namespace graph
} // namespace arm_compute \ No newline at end of file
diff --git a/src/graph2/nodes/EltwiseLayerNode.cpp b/src/graph/nodes/EltwiseLayerNode.cpp
index 149d926d29..b794043f2f 100644
--- a/src/graph2/nodes/EltwiseLayerNode.cpp
+++ b/src/graph/nodes/EltwiseLayerNode.cpp
@@ -21,14 +21,14 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#include "arm_compute/graph2/nodes/EltwiseLayerNode.h"
+#include "arm_compute/graph/nodes/EltwiseLayerNode.h"
-#include "arm_compute/graph2/Graph.h"
-#include "arm_compute/graph2/INodeVisitor.h"
+#include "arm_compute/graph/Graph.h"
+#include "arm_compute/graph/INodeVisitor.h"
namespace arm_compute
{
-namespace graph2
+namespace graph
{
EltwiseLayerNode::EltwiseLayerNode(EltwiseOperation op)
: _op(op)
@@ -79,5 +79,5 @@ void EltwiseLayerNode::accept(INodeVisitor &v)
{
v.visit(*this);
}
-} // namespace graph2
+} // namespace graph
} // namespace arm_compute
diff --git a/src/graph/nodes/FlattenLayer.cpp b/src/graph/nodes/FlattenLayer.cpp
deleted file mode 100644
index ea08296ba3..0000000000
--- a/src/graph/nodes/FlattenLayer.cpp
+++ /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.
- */
-#include "arm_compute/graph/nodes/FlattenLayer.h"
-
-#include "arm_compute/graph/Error.h"
-#include "arm_compute/graph/NodeContext.h"
-#include "arm_compute/graph/OperationRegistry.h"
-#include "support/ToolchainSupport.h"
-
-using namespace arm_compute::graph;
-
-std::unique_ptr<arm_compute::IFunction> FlattenLayer::instantiate_node(GraphContext &ctx, ITensorObject *input, ITensorObject *output)
-{
- ARM_COMPUTE_ERROR_ON_UNALLOCATED_TENSOR_OBJECT(input, output);
-
- _target_hint = ctx.hints().target_hint();
- arm_compute::ITensor *in = input->tensor();
- arm_compute::ITensor *out = output->tensor();
-
- // Auto configure output
- TensorShape tensor_shape = in->info()->tensor_shape();
- tensor_shape.collapse(in->info()->num_dimensions());
- arm_compute::auto_init_if_empty(*out->info(), tensor_shape, 1, in->info()->data_type(), in->info()->fixed_point_position());
-
- // Create node context
- NodeContext node_ctx(OperationType::FlattenLayer);
- node_ctx.set_target(_target_hint);
- node_ctx.add_input(in);
- node_ctx.add_output(out);
-
- // Get function
- return OperationRegistry::get().find_operation(OperationType::FlattenLayer, _target_hint)->configure(node_ctx);
-} \ No newline at end of file
diff --git a/src/graph2/nodes/FlattenLayerNode.cpp b/src/graph/nodes/FlattenLayerNode.cpp
index 7c4059f3ed..8b847c7056 100644
--- a/src/graph2/nodes/FlattenLayerNode.cpp
+++ b/src/graph/nodes/FlattenLayerNode.cpp
@@ -21,14 +21,14 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#include "arm_compute/graph2/nodes/FlattenLayerNode.h"
+#include "arm_compute/graph/nodes/FlattenLayerNode.h"
-#include "arm_compute/graph2/Graph.h"
-#include "arm_compute/graph2/INodeVisitor.h"
+#include "arm_compute/graph/Graph.h"
+#include "arm_compute/graph/INodeVisitor.h"
namespace arm_compute
{
-namespace graph2
+namespace graph
{
FlattenLayerNode::FlattenLayerNode()
{
@@ -76,5 +76,5 @@ void FlattenLayerNode::accept(INodeVisitor &v)
{
v.visit(*this);
}
-} // namespace graph2
+} // namespace graph
} // namespace arm_compute \ No newline at end of file
diff --git a/src/graph/nodes/FloorLayer.cpp b/src/graph/nodes/FloorLayer.cpp
deleted file mode 100644
index 8750546ed9..0000000000
--- a/src/graph/nodes/FloorLayer.cpp
+++ /dev/null
@@ -1,49 +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.
- */
-#include "arm_compute/graph/nodes/FloorLayer.h"
-
-#include "arm_compute/graph/Error.h"
-#include "arm_compute/graph/NodeContext.h"
-#include "arm_compute/graph/OperationRegistry.h"
-#include "support/ToolchainSupport.h"
-
-using namespace arm_compute::graph;
-
-std::unique_ptr<arm_compute::IFunction> FloorLayer::instantiate_node(GraphContext &ctx, ITensorObject *input, ITensorObject *output)
-{
- ARM_COMPUTE_ERROR_ON_UNALLOCATED_TENSOR_OBJECT(input, output);
-
- arm_compute::ITensor *in = input->tensor();
- arm_compute::ITensor *out = output->tensor();
- _target_hint = ctx.hints().target_hint();
-
- // Create node context
- NodeContext node_ctx(OperationType::FloorLayer);
- node_ctx.set_target(_target_hint);
- node_ctx.add_input(in);
- node_ctx.add_output(out);
-
- // Get function
- return OperationRegistry::get().find_operation(OperationType::FloorLayer, _target_hint)->configure(node_ctx);
-}
diff --git a/src/graph/nodes/FullyConnectedLayer.cpp b/src/graph/nodes/FullyConnectedLayer.cpp
index 3742150d37..cbf2b35ddd 100644
--- a/src/graph/nodes/FullyConnectedLayer.cpp
+++ b/src/graph/nodes/FullyConnectedLayer.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2018 ARM Limited.
+ * Copyright (c) 2018 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -21,18 +21,40 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#include "arm_compute/graph/nodes/FullyConnectedLayer.h"
+#include "arm_compute/graph/nodes/FullyConnectedLayerNode.h"
-#include "arm_compute/graph/Error.h"
-#include "arm_compute/graph/NodeContext.h"
-#include "arm_compute/graph/OperationRegistry.h"
-#include "support/ToolchainSupport.h"
+#include "arm_compute/core/Utils.h"
+#include "arm_compute/graph/Graph.h"
+#include "arm_compute/graph/INodeVisitor.h"
-using namespace arm_compute::graph;
+namespace arm_compute
+{
+namespace graph
+{
+FullyConnectedLayerNode::FullyConnectedLayerNode(unsigned int num_outputs)
+ : _num_outputs(num_outputs)
+{
+ _input_edges.resize(3, EmptyEdgeID);
+ _outputs.resize(1, NullTensorID);
+}
-namespace
+TensorShape FullyConnectedLayerNode::compute_weights_shape(TensorShape input_shape, unsigned int num_outputs)
{
-TensorShape calculate_fullyconnected_layer_output_shape(const TensorShape &input_shape, unsigned int output_neurons)
+ unsigned int num_weights = 1;
+ unsigned int num_dimensions = input_shape.num_dimensions();
+ // Ignore the batch dimension if there is one:
+ if(num_dimensions == 2 || num_dimensions == 4)
+ {
+ num_dimensions--;
+ }
+ for(unsigned int i = 0; i < num_dimensions; i++)
+ {
+ num_weights *= input_shape[i];
+ }
+ return TensorShape(num_weights, num_outputs);
+}
+
+TensorShape FullyConnectedLayerNode::compute_output_shape(TensorShape input_shape, unsigned int num_outputs)
{
// Note: Only 1D batch space is supported at the moment
unsigned int batches = input_shape[1];
@@ -40,67 +62,46 @@ TensorShape calculate_fullyconnected_layer_output_shape(const TensorShape &input
{
batches = input_shape[3];
}
- return TensorShape(output_neurons, batches);
+ return TensorShape(num_outputs, batches);
}
-} // namespace
-std::unique_ptr<arm_compute::IFunction> FullyConnectedLayer::instantiate_node(GraphContext &ctx, ITensorObject *input, ITensorObject *output)
+bool FullyConnectedLayerNode::forward_descriptors()
{
- ARM_COMPUTE_ERROR_ON_UNALLOCATED_TENSOR_OBJECT(input, output);
-
- arm_compute::ITensor *in = input->tensor();
- arm_compute::ITensor *out = output->tensor();
- _target_hint = ctx.hints().target_hint();
-
- if(_weights.tensor() == nullptr)
- {
- unsigned int num_weights = 1;
- unsigned int num_dimensions = in->info()->num_dimensions();
- // Ignore the batch dimension if there is one:
- if(num_dimensions == 2 || num_dimensions == 4)
- {
- num_dimensions--;
- }
- for(unsigned int i = 0; i < num_dimensions; i++)
- {
- num_weights *= in->info()->dimension(i);
- }
- _weights.set_info(TensorInfo(TensorShape(num_weights, _num_neurons), in->info()->num_channels(), in->info()->data_type(), in->info()->fixed_point_position()));
- }
- if(_biases.tensor() == nullptr)
+ if((input_id(0) != NullTensorID) && (output_id(0) != NullTensorID))
{
- _biases.set_info(TensorInfo(TensorShape(_num_neurons), in->info()->num_channels(), in->info()->data_type(), in->info()->fixed_point_position()));
+ Tensor *dst = output(0);
+ ARM_COMPUTE_ERROR_ON(dst == nullptr);
+ dst->desc() = configure_output(0);
+ return true;
}
+ return false;
+}
- // Auto configure output
- arm_compute::auto_init_if_empty(*out->info(),
- calculate_fullyconnected_layer_output_shape(in->info()->tensor_shape(), _num_neurons),
- in->info()->num_channels(), in->info()->data_type(), in->info()->fixed_point_position());
-
- bool weights_are_loaded = _weights.tensor() != nullptr;
- bool biases_are_loaded = _biases.tensor() != nullptr;
+TensorDescriptor FullyConnectedLayerNode::configure_output(size_t idx) const
+{
+ ARM_COMPUTE_UNUSED(idx);
+ const Tensor *src = input(0);
+ ARM_COMPUTE_ERROR_ON(src == nullptr);
- // Create node context
- NodeContext node_ctx(OperationType::FullyConnectedLayer);
- node_ctx.set_target(_target_hint);
- node_ctx.add_input(in);
- node_ctx.add_input(_weights.set_target(_target_hint));
- node_ctx.add_input(_biases.set_target(_target_hint));
- node_ctx.add_output(out);
+ TensorDescriptor output_info = src->desc();
+ TensorShape output_shape = compute_output_shape(src->desc().shape, _num_outputs);
+ output_info.shape = output_shape;
+ return output_info;
+}
- // Configure operation
- auto func = OperationRegistry::get().find_operation(OperationType::FullyConnectedLayer, _target_hint)->configure(node_ctx);
+Status FullyConnectedLayerNode::validate()
+{
+ return Status{};
+}
- // Fill biases
- if(!weights_are_loaded)
- {
- _weights.allocate_and_fill_if_needed();
- }
- if(!biases_are_loaded)
- {
- _biases.allocate_and_fill_if_needed();
- }
+NodeType FullyConnectedLayerNode::type() const
+{
+ return NodeType::FullyConnectedLayer;
+}
- // Get function
- return func;
+void FullyConnectedLayerNode::accept(INodeVisitor &v)
+{
+ v.visit(*this);
}
+} // namespace graph
+} // namespace arm_compute \ No newline at end of file
diff --git a/src/graph2/nodes/InputNode.cpp b/src/graph/nodes/InputNode.cpp
index 84cce2acdb..e912633a66 100644
--- a/src/graph2/nodes/InputNode.cpp
+++ b/src/graph/nodes/InputNode.cpp
@@ -21,14 +21,14 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#include "arm_compute/graph2/nodes/InputNode.h"
+#include "arm_compute/graph/nodes/InputNode.h"
-#include "arm_compute/graph2/Graph.h"
-#include "arm_compute/graph2/INodeVisitor.h"
+#include "arm_compute/graph/Graph.h"
+#include "arm_compute/graph/INodeVisitor.h"
namespace arm_compute
{
-namespace graph2
+namespace graph
{
InputNode::InputNode(TensorDescriptor desc)
: _desc(desc)
@@ -68,5 +68,5 @@ void InputNode::accept(INodeVisitor &v)
{
v.visit(*this);
}
-} // namespace graph2
+} // namespace graph
} // namespace arm_compute
diff --git a/src/graph/nodes/L2NormalizeLayer.cpp b/src/graph/nodes/L2NormalizeLayer.cpp
deleted file mode 100644
index 9813ba4450..0000000000
--- a/src/graph/nodes/L2NormalizeLayer.cpp
+++ /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.
- */
-#include "arm_compute/graph/nodes/L2NormalizeLayer.h"
-
-#include "arm_compute/graph/Error.h"
-#include "arm_compute/graph/NodeContext.h"
-#include "arm_compute/graph/OperationRegistry.h"
-#include "support/ToolchainSupport.h"
-
-using namespace arm_compute::graph;
-
-L2NormalizeLayer::L2NormalizeLayer(unsigned int axis, float epsilon)
- : _axis(axis), _epsilon(epsilon)
-{
-}
-
-std::unique_ptr<arm_compute::IFunction> L2NormalizeLayer::instantiate_node(GraphContext &ctx, ITensorObject *input, ITensorObject *output)
-{
- ARM_COMPUTE_ERROR_ON_UNALLOCATED_TENSOR_OBJECT(input, output);
-
- arm_compute::ITensor *in = input->tensor();
- arm_compute::ITensor *out = output->tensor();
- _target_hint = ctx.hints().target_hint();
-
- // Create node context
- NodeContext node_ctx(OperationType::L2NormalizeLayer);
- node_ctx.set_target(_target_hint);
- node_ctx.add_input(in);
- node_ctx.add_output(out);
- node_ctx.add_parameter<unsigned int>("axis", _axis);
- node_ctx.add_parameter<float>("epsilon", _epsilon);
-
- // Get function
- return OperationRegistry::get().find_operation(OperationType::L2NormalizeLayer, _target_hint)->configure(node_ctx);
-}
diff --git a/src/graph/nodes/NormalizationLayer.cpp b/src/graph/nodes/NormalizationLayer.cpp
deleted file mode 100644
index a489329243..0000000000
--- a/src/graph/nodes/NormalizationLayer.cpp
+++ /dev/null
@@ -1,55 +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.
- */
-#include "arm_compute/graph/nodes/NormalizationLayer.h"
-
-#include "arm_compute/graph/Error.h"
-#include "arm_compute/graph/NodeContext.h"
-#include "arm_compute/graph/OperationRegistry.h"
-#include "support/ToolchainSupport.h"
-
-using namespace arm_compute::graph;
-
-NormalizationLayer::NormalizationLayer(const NormalizationLayerInfo norm_info)
- : _norm_info(norm_info)
-{
-}
-
-std::unique_ptr<arm_compute::IFunction> NormalizationLayer::instantiate_node(GraphContext &ctx, ITensorObject *input, ITensorObject *output)
-{
- ARM_COMPUTE_ERROR_ON_UNALLOCATED_TENSOR_OBJECT(input, output);
-
- arm_compute::ITensor *in = input->tensor();
- arm_compute::ITensor *out = output->tensor();
- _target_hint = ctx.hints().target_hint();
-
- // Create node context
- NodeContext node_ctx(OperationType::NormalizationLayer);
- node_ctx.set_target(_target_hint);
- node_ctx.add_input(in);
- node_ctx.add_output(out);
- node_ctx.add_parameter<NormalizationLayerInfo>("NormalizationLayerInfo", _norm_info);
-
- // Get function
- return OperationRegistry::get().find_operation(OperationType::NormalizationLayer, _target_hint)->configure(node_ctx);
-}
diff --git a/src/graph2/nodes/NormalizationLayerNode.cpp b/src/graph/nodes/NormalizationLayerNode.cpp
index a394879a3e..a9f2fbd066 100644
--- a/src/graph2/nodes/NormalizationLayerNode.cpp
+++ b/src/graph/nodes/NormalizationLayerNode.cpp
@@ -21,15 +21,15 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#include "arm_compute/graph2/nodes/NormalizationLayerNode.h"
+#include "arm_compute/graph/nodes/NormalizationLayerNode.h"
#include "arm_compute/core/Utils.h"
-#include "arm_compute/graph2/Graph.h"
-#include "arm_compute/graph2/INodeVisitor.h"
+#include "arm_compute/graph/Graph.h"
+#include "arm_compute/graph/INodeVisitor.h"
namespace arm_compute
{
-namespace graph2
+namespace graph
{
NormalizationLayerNode::NormalizationLayerNode(NormalizationLayerInfo norm_info)
: _info(norm_info)
@@ -80,5 +80,5 @@ void NormalizationLayerNode::accept(INodeVisitor &v)
{
v.visit(*this);
}
-} // namespace graph2
+} // namespace graph
} // namespace arm_compute \ No newline at end of file
diff --git a/src/graph2/nodes/OutputNode.cpp b/src/graph/nodes/OutputNode.cpp
index 1daebb1cc8..4c63bfa20c 100644
--- a/src/graph2/nodes/OutputNode.cpp
+++ b/src/graph/nodes/OutputNode.cpp
@@ -21,16 +21,16 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#include "arm_compute/graph2/nodes/OutputNode.h"
+#include "arm_compute/graph/nodes/OutputNode.h"
#include "arm_compute/core/Error.h"
-#include "arm_compute/graph2/Graph.h"
-#include "arm_compute/graph2/INodeVisitor.h"
-#include "arm_compute/graph2/Tensor.h"
+#include "arm_compute/graph/Graph.h"
+#include "arm_compute/graph/INodeVisitor.h"
+#include "arm_compute/graph/Tensor.h"
namespace arm_compute
{
-namespace graph2
+namespace graph
{
OutputNode::OutputNode()
{
@@ -62,5 +62,5 @@ void OutputNode::accept(INodeVisitor &v)
{
v.visit(*this);
}
-} // namespace graph2
+} // namespace graph
} // namespace arm_compute
diff --git a/src/graph/nodes/PoolingLayer.cpp b/src/graph/nodes/PoolingLayer.cpp
deleted file mode 100644
index 2c151194f3..0000000000
--- a/src/graph/nodes/PoolingLayer.cpp
+++ /dev/null
@@ -1,55 +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.
- */
-#include "arm_compute/graph/nodes/PoolingLayer.h"
-
-#include "arm_compute/graph/Error.h"
-#include "arm_compute/graph/NodeContext.h"
-#include "arm_compute/graph/OperationRegistry.h"
-#include "support/ToolchainSupport.h"
-
-using namespace arm_compute::graph;
-
-PoolingLayer::PoolingLayer(const PoolingLayerInfo pool_info)
- : _pool_info(pool_info)
-{
-}
-
-std::unique_ptr<arm_compute::IFunction> PoolingLayer::instantiate_node(GraphContext &ctx, ITensorObject *input, ITensorObject *output)
-{
- ARM_COMPUTE_ERROR_ON_UNALLOCATED_TENSOR_OBJECT(input, output);
-
- arm_compute::ITensor *in = input->tensor();
- arm_compute::ITensor *out = output->tensor();
- _target_hint = ctx.hints().target_hint();
-
- // Create node context
- NodeContext node_ctx(OperationType::PoolingLayer);
- node_ctx.set_target(_target_hint);
- node_ctx.add_input(in);
- node_ctx.add_output(out);
- node_ctx.add_parameter<PoolingLayerInfo>("PoolingLayerInfo", _pool_info);
-
- // Get function
- return OperationRegistry::get().find_operation(OperationType::PoolingLayer, _target_hint)->configure(node_ctx);
-}
diff --git a/src/graph2/nodes/PoolingLayerNode.cpp b/src/graph/nodes/PoolingLayerNode.cpp
index 2c2cf5387a..a7b6b3679a 100644
--- a/src/graph2/nodes/PoolingLayerNode.cpp
+++ b/src/graph/nodes/PoolingLayerNode.cpp
@@ -21,15 +21,15 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#include "arm_compute/graph2/nodes/PoolingLayerNode.h"
+#include "arm_compute/graph/nodes/PoolingLayerNode.h"
#include "arm_compute/core/Utils.h"
-#include "arm_compute/graph2/Graph.h"
-#include "arm_compute/graph2/INodeVisitor.h"
+#include "arm_compute/graph/Graph.h"
+#include "arm_compute/graph/INodeVisitor.h"
namespace arm_compute
{
-namespace graph2
+namespace graph
{
PoolingLayerNode::PoolingLayerNode(PoolingLayerInfo pool_info)
: _info(std::move(pool_info))
@@ -99,5 +99,5 @@ void PoolingLayerNode::accept(INodeVisitor &v)
{
v.visit(*this);
}
-} // namespace graph2
+} // namespace graph
} // namespace arm_compute \ No newline at end of file
diff --git a/src/graph/nodes/QuantizationLayer.cpp b/src/graph/nodes/QuantizationLayer.cpp
deleted file mode 100644
index c102f47633..0000000000
--- a/src/graph/nodes/QuantizationLayer.cpp
+++ /dev/null
@@ -1,48 +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.
- */
-#include "arm_compute/graph/nodes/QuantizationLayer.h"
-
-#include "arm_compute/graph/Error.h"
-#include "arm_compute/graph/NodeContext.h"
-#include "arm_compute/graph/OperationRegistry.h"
-
-using namespace arm_compute::graph;
-
-std::unique_ptr<arm_compute::IFunction> QuantizationLayer::instantiate_node(GraphContext &ctx, ITensorObject *input, ITensorObject *output)
-{
- ARM_COMPUTE_ERROR_ON_UNALLOCATED_TENSOR_OBJECT(input, output);
-
- _target_hint = ctx.hints().target_hint();
- arm_compute::ITensor *in = input->tensor();
- arm_compute::ITensor *out = output->tensor();
-
- // Create node context
- NodeContext node_ctx(OperationType::QuantizationLayer);
- node_ctx.set_target(_target_hint);
- node_ctx.add_input(in);
- node_ctx.add_output(out);
-
- // Get function
- return OperationRegistry::get().find_operation(OperationType::QuantizationLayer, _target_hint)->configure(node_ctx);
-}
diff --git a/src/graph/nodes/ReshapeLayer.cpp b/src/graph/nodes/ReshapeLayer.cpp
index b0c117e418..2757f06bd3 100644
--- a/src/graph/nodes/ReshapeLayer.cpp
+++ b/src/graph/nodes/ReshapeLayer.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2018 ARM Limited.
+ * Copyright (c) 2018 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -21,37 +21,61 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#include "arm_compute/graph/nodes/ReshapeLayer.h"
+#include "arm_compute/graph/nodes/ReshapeLayerNode.h"
-#include "arm_compute/graph/Error.h"
-#include "arm_compute/graph/NodeContext.h"
-#include "arm_compute/graph/OperationRegistry.h"
-#include "support/ToolchainSupport.h"
+#include "arm_compute/graph/Graph.h"
+#include "arm_compute/graph/INodeVisitor.h"
-using namespace arm_compute::graph;
-
-ReshapeLayer::ReshapeLayer(TensorShape shape)
+namespace arm_compute
+{
+namespace graph
+{
+ReshapeLayerNode::ReshapeLayerNode(TensorShape shape)
: _shape(shape)
{
+ _input_edges.resize(1, EmptyEdgeID);
+ _outputs.resize(1, NullTensorID);
}
-std::unique_ptr<arm_compute::IFunction> ReshapeLayer::instantiate_node(GraphContext &ctx, ITensorObject *input, ITensorObject *output)
+bool ReshapeLayerNode::forward_descriptors()
{
- ARM_COMPUTE_ERROR_ON_UNALLOCATED_TENSOR_OBJECT(input, output);
+ if((input_id(0) != NullTensorID) && (output_id(0) != NullTensorID))
+ {
+ Tensor *dst = output(0);
+ ARM_COMPUTE_ERROR_ON(dst == nullptr);
+ dst->desc() = configure_output(0);
+ return true;
+ }
+ return false;
+}
+
+TensorDescriptor ReshapeLayerNode::configure_output(size_t idx) const
+{
+ ARM_COMPUTE_UNUSED(idx);
+ ARM_COMPUTE_ERROR_ON(idx >= _outputs.size());
+
+ const Tensor *src = input(0);
+ ARM_COMPUTE_ERROR_ON(src == nullptr);
- _target_hint = ctx.hints().target_hint();
- arm_compute::ITensor *in = input->tensor();
- arm_compute::ITensor *out = output->tensor();
+ TensorDescriptor output_desc = src->desc();
+ output_desc.shape = _shape;
- // Auto configure output
- arm_compute::auto_init_if_empty(*out->info(), _shape, 1, in->info()->data_type(), in->info()->fixed_point_position(), in->info()->quantization_info());
+ return output_desc;
+}
- // Create node context
- NodeContext node_ctx(OperationType::ReshapeLayer);
- node_ctx.set_target(_target_hint);
- node_ctx.add_input(in);
- node_ctx.add_output(out);
+Status ReshapeLayerNode::validate()
+{
+ return Status{};
+}
- // Get function
- return OperationRegistry::get().find_operation(OperationType::ReshapeLayer, _target_hint)->configure(node_ctx);
+NodeType ReshapeLayerNode::type() const
+{
+ return NodeType::ReshapeLayer;
+}
+
+void ReshapeLayerNode::accept(INodeVisitor &v)
+{
+ v.visit(*this);
}
+} // namespace graph
+} // namespace arm_compute \ No newline at end of file
diff --git a/src/graph/nodes/ResidualLayer.cpp b/src/graph/nodes/ResidualLayer.cpp
deleted file mode 100644
index 87404f9e1f..0000000000
--- a/src/graph/nodes/ResidualLayer.cpp
+++ /dev/null
@@ -1,199 +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.
- */
-#include "arm_compute/graph/nodes/ResidualLayer.h"
-
-#include "arm_compute/graph/Error.h"
-#include "arm_compute/graph/Graph.h"
-#include "arm_compute/graph/NodeContext.h"
-#include "arm_compute/graph/OperationRegistry.h"
-#include "arm_compute/graph/SubGraph.h"
-#include "arm_compute/graph/Tensor.h"
-#include "arm_compute/runtime/IFunction.h"
-#include "support/ToolchainSupport.h"
-#include "utils/Utils.h"
-
-#include <memory>
-#include <tuple>
-#include <vector>
-
-using namespace arm_compute::graph;
-
-/** Residual function */
-class ResidualFunction final : public arm_compute::IFunction
-{
-public:
- /** Default Constructor */
- ResidualFunction(GraphContext &ctx, ITensorObject *output)
- : _ctx(ctx), _input(nullptr), _output(output), _func(nullptr), _graphs(), _graph_outputs()
- {
- }
-
- /** Prevent instances from being copy constructed */
- ResidualFunction(const ResidualFunction &) = delete;
- /** Prevent instances from being copy assigned */
- const ResidualFunction &operator=(const ResidualFunction &) = delete;
- /** Prevent instances from being move constructed */
- ResidualFunction(ResidualFunction &&) = delete;
- /** Prevent instances from being move assigned */
- ResidualFunction &operator=(ResidualFunction &&) = delete;
- /** Default destructor */
- ~ResidualFunction() override = default;
-
- /** Set the input (when using only one sub graph)
- *
- * @param[in] input Input to set
- */
- void set_input(std::unique_ptr<ITensorObject> input)
- {
- _input = std::move(input);
- }
-
- /** Registers graph to be executed by the residual function
- *
- * @param[in] graph Graph to register
- * @param[in] output Output to register
- */
- void register_graph(std::unique_ptr<Graph> graph, std::unique_ptr<ITensorObject> output)
- {
- _graphs.push_back(std::move(graph));
- _graph_outputs.push_back(std::move(output));
- }
-
- /** Configure the function */
- void configure()
- {
- ARM_COMPUTE_ERROR_ON(_graphs.size() < 1 || _graphs.size() > 2);
- TargetHint target_hint = _ctx.hints().target_hint();
-
- // Create node context
- NodeContext node_ctx(OperationType::ArithmeticAddition);
- node_ctx.set_target(target_hint);
-
- if(_graphs.size() == 1)
- {
- arm_compute::ITensor *in = _input->tensor();
- node_ctx.add_input(in);
- }
-
- for(auto &o : _graph_outputs)
- {
- arm_compute::ITensor *in = o->tensor();
- node_ctx.add_input(in);
- }
-
- arm_compute::ITensor *out = _output->tensor();
- auto_init_if_empty(*out->info(), *_graph_outputs[0]->tensor()->info());
- node_ctx.add_output(out);
-
- _func = OperationRegistry::get().find_operation(OperationType::ArithmeticAddition, target_hint)->configure(node_ctx);
-
- for(auto &o : _graph_outputs)
- {
- o->allocate();
- }
- }
-
- // Inherited methods overriden:
- void run() override
- {
- ARM_COMPUTE_ERROR_ON(_graphs.size() < 1 || _graphs.size() > 2);
-
- for(auto &g : _graphs)
- {
- ARM_COMPUTE_ERROR_ON(g.get() == nullptr);
- g->run();
- }
-
- _func->run();
- }
-
-private:
- GraphContext _ctx;
- std::unique_ptr<ITensorObject> _input;
- ITensorObject *_output;
- std::unique_ptr<arm_compute::IFunction> _func;
- std::vector<std::unique_ptr<Graph>> _graphs;
- std::vector<std::unique_ptr<ITensorObject>> _graph_outputs;
-};
-
-std::unique_ptr<arm_compute::IFunction> ResidualLayer::instantiate_node(GraphContext &ctx, ITensorObject *input, ITensorObject *output)
-{
- ARM_COMPUTE_ERROR_ON_UNALLOCATED_TENSOR_OBJECT(input, output);
- ARM_COMPUTE_ERROR_ON(dynamic_cast<Tensor *>(input) == nullptr);
- ARM_COMPUTE_ERROR_ON(dynamic_cast<Tensor *>(output) == nullptr);
-
- // Create residual function
- auto func = arm_compute::support::cpp14::make_unique<ResidualFunction>(ctx, output);
-
- if(_sub_graphs.size() == 1)
- {
- std::unique_ptr<ITensorObject> original_in;
- original_in = arm_compute::support::cpp14::make_unique<SubTensor>(*dynamic_cast<Tensor *>(input),
- input->tensor()->info()->tensor_shape(),
- Coordinates());
- func->set_input(std::move(original_in));
- }
-
- // Constuct all sub-graphs given the input/output
- for(auto &sg : _sub_graphs)
- {
- ARM_COMPUTE_ERROR_ON(sg.get() == nullptr);
-
- // IO buffers
- std::unique_ptr<ITensorObject> in;
- std::unique_ptr<ITensorObject> out;
- std::unique_ptr<ITensorObject> func_in;
-
- // Create input sub-tensor
- if(!sg->has_input())
- {
- in = arm_compute::support::cpp14::make_unique<SubTensor>(*dynamic_cast<Tensor *>(input),
- input->tensor()->info()->tensor_shape(),
- Coordinates());
- }
-
- // Create output sub-tensor
- if(!sg->has_output())
- {
- ITensorInfo *info = input->tensor()->info();
- func_in = arm_compute::support::cpp14::make_unique<Tensor>(TensorInfo(info->num_channels(), info->data_type(), info->fixed_point_position()));
- func_in->set_target(ctx.hints().target_hint());
- out = arm_compute::support::cpp14::make_unique<SubTensor>(func_in->tensor(),
- TensorShape(),
- Coordinates(0, 0, 0),
- func_in->target(),
- true);
- }
-
- // Construct sub_graph
- auto g = sg->construct(ctx, std::move(in), std::move(out));
-
- // Register graph to function
- func->register_graph(std::move(g), std::move(func_in));
- }
-
- func->configure();
-
- return std::move(func);
-}
diff --git a/src/graph/nodes/SoftmaxLayer.cpp b/src/graph/nodes/SoftmaxLayer.cpp
deleted file mode 100644
index 7f2325b312..0000000000
--- a/src/graph/nodes/SoftmaxLayer.cpp
+++ /dev/null
@@ -1,49 +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.
- */
-#include "arm_compute/graph/nodes/SoftmaxLayer.h"
-
-#include "arm_compute/graph/Error.h"
-#include "arm_compute/graph/NodeContext.h"
-#include "arm_compute/graph/OperationRegistry.h"
-#include "support/ToolchainSupport.h"
-
-using namespace arm_compute::graph;
-
-std::unique_ptr<arm_compute::IFunction> SoftmaxLayer::instantiate_node(GraphContext &ctx, ITensorObject *input, ITensorObject *output)
-{
- ARM_COMPUTE_ERROR_ON_UNALLOCATED_TENSOR_OBJECT(input, output);
-
- arm_compute::ITensor *in = input->tensor();
- arm_compute::ITensor *out = output->tensor();
- _target_hint = ctx.hints().target_hint();
-
- // Create node context
- NodeContext node_ctx(OperationType::SoftmaxLayer);
- node_ctx.set_target(_target_hint);
- node_ctx.add_input(in);
- node_ctx.add_output(out);
-
- // Get function
- return OperationRegistry::get().find_operation(OperationType::SoftmaxLayer, _target_hint)->configure(node_ctx);
-}
diff --git a/src/graph2/nodes/SoftmaxLayerNode.cpp b/src/graph/nodes/SoftmaxLayerNode.cpp
index 83bc978981..4c21ac6ad0 100644
--- a/src/graph2/nodes/SoftmaxLayerNode.cpp
+++ b/src/graph/nodes/SoftmaxLayerNode.cpp
@@ -21,15 +21,15 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#include "arm_compute/graph2/nodes/SoftmaxLayerNode.h"
+#include "arm_compute/graph/nodes/SoftmaxLayerNode.h"
#include "arm_compute/core/Utils.h"
-#include "arm_compute/graph2/Graph.h"
-#include "arm_compute/graph2/INodeVisitor.h"
+#include "arm_compute/graph/Graph.h"
+#include "arm_compute/graph/INodeVisitor.h"
namespace arm_compute
{
-namespace graph2
+namespace graph
{
SoftmaxLayerNode::SoftmaxLayerNode(float beta)
: _beta(beta)
@@ -80,5 +80,5 @@ void SoftmaxLayerNode::accept(INodeVisitor &v)
{
v.visit(*this);
}
-} // namespace graph2
+} // namespace graph
} // namespace arm_compute \ No newline at end of file
diff --git a/src/graph2/nodes/SplitLayerNode.cpp b/src/graph/nodes/SplitLayerNode.cpp
index c34a7ff176..c8fb43c2a1 100644
--- a/src/graph2/nodes/SplitLayerNode.cpp
+++ b/src/graph/nodes/SplitLayerNode.cpp
@@ -21,15 +21,15 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#include "arm_compute/graph2/nodes/SplitLayerNode.h"
+#include "arm_compute/graph/nodes/SplitLayerNode.h"
#include "arm_compute/core/Utils.h"
-#include "arm_compute/graph2/Graph.h"
-#include "arm_compute/graph2/INodeVisitor.h"
+#include "arm_compute/graph/Graph.h"
+#include "arm_compute/graph/INodeVisitor.h"
namespace arm_compute
{
-namespace graph2
+namespace graph
{
SplitLayerNode::SplitLayerNode(unsigned int num_splits, unsigned int axis)
: _num_splits(num_splits), _axis(axis)
@@ -113,5 +113,5 @@ void SplitLayerNode::accept(INodeVisitor &v)
{
v.visit(*this);
}
-} // namespace graph2
+} // namespace graph
} // namespace arm_compute \ No newline at end of file
diff --git a/src/graph/operations/CLSimpleOperations.cpp b/src/graph/operations/CLSimpleOperations.cpp
deleted file mode 100644
index fe56122009..0000000000
--- a/src/graph/operations/CLSimpleOperations.cpp
+++ /dev/null
@@ -1,495 +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.
- */
-#include "arm_compute/core/CL/ICLTensor.h"
-#include "arm_compute/core/Error.h"
-#include "arm_compute/graph/IOperation.h"
-#include "arm_compute/graph/NodeContext.h"
-#include "arm_compute/graph/OperationRegistrar.h"
-#include "arm_compute/graph/Types.h"
-#include "arm_compute/runtime/CL/CLFunctions.h"
-#include "support/ToolchainSupport.h"
-#include "utils/GraphTypePrinter.h"
-#include "utils/TypePrinter.h"
-
-#include <memory>
-
-using namespace arm_compute::graph;
-
-/* Activation Layer */
-REGISTER_SIMPLE_OPERATION(CLActivationLayerOperation, OPENCL, OperationType::ActivationLayer)
-{
- ARM_COMPUTE_ERROR_ON(ctx.num_inputs() != 1);
- ARM_COMPUTE_ERROR_ON(ctx.num_outputs() != 1);
- ARM_COMPUTE_ERROR_ON(dynamic_cast<arm_compute::ICLTensor *>(ctx.input(0)) == nullptr);
- ARM_COMPUTE_ERROR_ON(dynamic_cast<arm_compute::ICLTensor *>(ctx.output(0)) == nullptr);
-
- // Extract IO and info
- auto *in = dynamic_cast<arm_compute::ICLTensor *>(ctx.input(0));
- auto *out = dynamic_cast<arm_compute::ICLTensor *>(ctx.output(0));
- const auto act_info = ctx.parameter<ActivationLayerInfo>("ActivationLayerInfo");
-
- // Create and configure function
- auto activation = arm_compute::support::cpp14::make_unique<arm_compute::CLActivationLayer>();
- activation->configure(in, out, act_info);
-
- // Log info
- ARM_COMPUTE_LOG_GRAPH_INFO("Instantiating CLActivationLayer"
- << " Data Type: " << in->info()->data_type()
- << " Input shape: " << in->info()->tensor_shape()
- << " Output shape: " << out->info()->tensor_shape()
- << " Activation function: " << act_info.activation()
- << " a: " << act_info.a()
- << " b: " << act_info.b()
- << std::endl);
-
- return std::move(activation);
-}
-
-/* Arithmetic addition */
-REGISTER_SIMPLE_OPERATION(CLArithmeticAdditionOperation, OPENCL, OperationType::ArithmeticAddition)
-{
- ARM_COMPUTE_ERROR_ON(ctx.num_inputs() != 2);
- ARM_COMPUTE_ERROR_ON(ctx.num_outputs() != 1);
- ARM_COMPUTE_ERROR_ON(dynamic_cast<arm_compute::ICLTensor *>(ctx.input(0)) == nullptr);
- ARM_COMPUTE_ERROR_ON(dynamic_cast<arm_compute::ICLTensor *>(ctx.input(1)) == nullptr);
- ARM_COMPUTE_ERROR_ON(dynamic_cast<arm_compute::ICLTensor *>(ctx.output(0)) == nullptr);
-
- // Extract IO and info
- auto *in1 = dynamic_cast<arm_compute::ICLTensor *>(ctx.input(0));
- auto *in2 = dynamic_cast<arm_compute::ICLTensor *>(ctx.input(1));
- auto *out = dynamic_cast<arm_compute::ICLTensor *>(ctx.output(0));
-
- auto addition = arm_compute::support::cpp14::make_unique<arm_compute::CLArithmeticAddition>();
- addition->configure(in1, in2, out, ConvertPolicy::SATURATE);
-
- // Log info
- ARM_COMPUTE_LOG_GRAPH_INFO("Instantiating CLArithmeticAddition"
- << " Data Type: " << in1->info()->data_type()
- << " Input 1 shape: " << in1->info()->tensor_shape()
- << " Input 2 shape: " << in2->info()->tensor_shape()
- << " Output shape: " << out->info()->tensor_shape()
- << std::endl);
-
- return std::move(addition);
-}
-
-/* Batch Normalization Layer */
-REGISTER_SIMPLE_OPERATION(CLBatchNormalizationLayerOperation, OPENCL, OperationType::BatchNormalizationLayer)
-{
- ARM_COMPUTE_ERROR_ON(ctx.num_inputs() != 5);
- ARM_COMPUTE_ERROR_ON(ctx.num_outputs() != 1);
- ARM_COMPUTE_ERROR_ON(dynamic_cast<arm_compute::ICLTensor *>(ctx.input(0)) == nullptr);
- ARM_COMPUTE_ERROR_ON(dynamic_cast<arm_compute::ICLTensor *>(ctx.input(1)) == nullptr);
- ARM_COMPUTE_ERROR_ON(dynamic_cast<arm_compute::ICLTensor *>(ctx.input(2)) == nullptr);
- ARM_COMPUTE_ERROR_ON(dynamic_cast<arm_compute::ICLTensor *>(ctx.input(3)) == nullptr);
- ARM_COMPUTE_ERROR_ON(dynamic_cast<arm_compute::ICLTensor *>(ctx.input(4)) == nullptr);
- ARM_COMPUTE_ERROR_ON(dynamic_cast<arm_compute::ICLTensor *>(ctx.output(0)) == nullptr);
-
- // Extract IO and info
- auto *in = dynamic_cast<arm_compute::ICLTensor *>(ctx.input(0));
- auto *mean = dynamic_cast<arm_compute::ICLTensor *>(ctx.input(1));
- auto *var = dynamic_cast<arm_compute::ICLTensor *>(ctx.input(2));
- auto *beta = dynamic_cast<arm_compute::ICLTensor *>(ctx.input(3));
- auto *gamma = dynamic_cast<arm_compute::ICLTensor *>(ctx.input(4));
- auto *out = dynamic_cast<arm_compute::ICLTensor *>(ctx.output(0));
- const auto epsilon = ctx.parameter<float>("epsilon");
- const auto act_info = ctx.parameter<ActivationLayerInfo>("act_info");
-
- // Create and configure function
- auto batch_norm = arm_compute::support::cpp14::make_unique<arm_compute::CLBatchNormalizationLayer>();
- batch_norm->configure(in, out, mean, var, beta, gamma, epsilon, act_info);
-
- // Log info
- ARM_COMPUTE_LOG_GRAPH_INFO("Instantiating CLBatchNormalizationLayer"
- << " Data Type: " << in->info()->data_type()
- << " Input shape: " << in->info()->tensor_shape()
- << " Output shape: " << out->info()->tensor_shape()
- << " Mean shape: " << mean->info()->tensor_shape()
- << " Var shape: " << var->info()->tensor_shape()
- << " Beta shape: " << beta->info()->tensor_shape()
- << " Gamma shape: " << gamma->info()->tensor_shape()
- << " Epsilon: " << epsilon
- << " Activation function: " << act_info.activation()
- << " a: " << act_info.a()
- << " b: " << act_info.b()
- << std::endl);
-
- return std::move(batch_norm);
-}
-
-/* DepthConvertLayer Layer */
-REGISTER_SIMPLE_OPERATION(CLDepthConvertLayerOperation, OPENCL, OperationType::DepthConvertLayer)
-{
- ARM_COMPUTE_ERROR_ON(ctx.num_inputs() != 1);
- ARM_COMPUTE_ERROR_ON(ctx.num_outputs() != 1);
- ARM_COMPUTE_ERROR_ON(dynamic_cast<arm_compute::ICLTensor *>(ctx.input(0)) == nullptr);
- ARM_COMPUTE_ERROR_ON(dynamic_cast<arm_compute::ICLTensor *>(ctx.output(0)) == nullptr);
-
- // Extract IO and info
- auto *in = dynamic_cast<arm_compute::ICLTensor *>(ctx.input(0));
- auto *out = dynamic_cast<arm_compute::ICLTensor *>(ctx.output(0));
- const auto conv_policy = ctx.parameter<ConvertPolicy>("ConvertPolicy");
- const auto shift = ctx.parameter<uint32_t>("shift");
-
- // Create and configure function
- auto depthconvert = arm_compute::support::cpp14::make_unique<arm_compute::CLDepthConvertLayer>();
- depthconvert->configure(in, out, conv_policy, shift);
-
- // Log info
- ARM_COMPUTE_LOG_GRAPH_INFO("Instantiating CLDepthConvertLayer"
- << " Data Type: " << in->info()->data_type()
- << " Input shape: " << in->info()->tensor_shape()
- << " Output shape: " << out->info()->tensor_shape()
- << " shift: " << shift
- << std::endl);
-
- return std::move(depthconvert);
-}
-
-/* DepthwiseConvolutionLayer Layer */
-REGISTER_SIMPLE_OPERATION(CLDepthwiseConvolutionOperation, OPENCL, OperationType::DepthwiseConvolutionLayer)
-{
- ARM_COMPUTE_ERROR_ON(ctx.num_inputs() != 2 && ctx.num_inputs() != 3);
- ARM_COMPUTE_ERROR_ON(ctx.num_outputs() != 1);
- ARM_COMPUTE_ERROR_ON(dynamic_cast<arm_compute::ICLTensor *>(ctx.input(0)) == nullptr);
- ARM_COMPUTE_ERROR_ON(dynamic_cast<arm_compute::ICLTensor *>(ctx.output(0)) == nullptr);
-
- // Extract IO and info
- auto *in = dynamic_cast<arm_compute::ICLTensor *>(ctx.input(0));
- auto *weights = dynamic_cast<arm_compute::ICLTensor *>(ctx.input(1));
- auto *biases = ctx.num_inputs() == 3 ? dynamic_cast<arm_compute::ICLTensor *>(ctx.input(2)) : nullptr;
- auto *out = dynamic_cast<arm_compute::ICLTensor *>(ctx.output(0));
- const auto conv_info = ctx.parameter<PadStrideInfo>("ConvolutionInfo");
- const auto opt3x3 = ctx.parameter<bool>("Optimized3x3");
-
- // Create and configure function
- std::unique_ptr<arm_compute::IFunction> func;
- bool run_3x3_opt = opt3x3 && weights->info()->dimension(0) == 3;
- if(run_3x3_opt)
- {
- auto depwthwise_conv = arm_compute::support::cpp14::make_unique<arm_compute::CLDepthwiseConvolutionLayer3x3>();
- depwthwise_conv->configure(in, weights, biases, out, conv_info);
- func = std::move(depwthwise_conv);
- }
- else
- {
- auto depwthwise_conv = arm_compute::support::cpp14::make_unique<arm_compute::CLDepthwiseConvolutionLayer>();
- depwthwise_conv->configure(in, weights, biases, out, conv_info);
- func = std::move(depwthwise_conv);
- }
-
- // Log info
- ARM_COMPUTE_LOG_GRAPH_INFO("Instantiating CLDepthwiseConvolutionLayer"
- << " Data Type: " << in->info()->data_type()
- << " Input shape: " << in->info()->tensor_shape()
- << " Weights shape: " << weights->info()->tensor_shape()
- << " Output shape: " << out->info()->tensor_shape());
- if(biases == nullptr)
- {
- ARM_COMPUTE_LOG_GRAPH_INFO(" Biases shape: No biases provided" << std::endl);
- }
- else
- {
- ARM_COMPUTE_LOG_GRAPH_INFO(" Biases shape: " << biases->info()->tensor_shape() << std::endl);
- }
-
- return func;
-}
-
-/* DeQuantizationLayer Layer */
-REGISTER_SIMPLE_OPERATION(CLDequantizationLayerOperation, OPENCL, OperationType::DequantizationLayer)
-{
- ARM_COMPUTE_ERROR_ON(ctx.num_inputs() != 1);
- ARM_COMPUTE_ERROR_ON(ctx.num_outputs() != 2);
- ARM_COMPUTE_ERROR_ON(dynamic_cast<arm_compute::ICLTensor *>(ctx.input(0)) == nullptr);
- ARM_COMPUTE_ERROR_ON(dynamic_cast<arm_compute::ICLTensor *>(ctx.output(0)) == nullptr);
- ARM_COMPUTE_ERROR_ON(dynamic_cast<arm_compute::ICLTensor *>(ctx.output(1)) == nullptr);
-
- // Extract IO and info
- auto *in = dynamic_cast<arm_compute::ICLTensor *>(ctx.input(0));
- auto *out = dynamic_cast<arm_compute::ICLTensor *>(ctx.output(0));
- auto *min_max = dynamic_cast<arm_compute::ICLTensor *>(ctx.output(1));
-
- // Create and configure function
- auto dequantization = arm_compute::support::cpp14::make_unique<arm_compute::CLDequantizationLayer>();
- dequantization->configure(in, out, min_max);
-
- // Log info
- ARM_COMPUTE_LOG_GRAPH_INFO("Instantiating CLDequantizationLayer"
- << " Data Type: " << in->info()->data_type()
- << " Input shape: " << in->info()->tensor_shape()
- << " Output shape: " << out->info()->tensor_shape()
- << " Min max shape: " << min_max->info()->tensor_shape()
- << std::endl);
-
- return std::move(dequantization);
-}
-
-/* Flatten Layer */
-REGISTER_SIMPLE_OPERATION(CLFlattenLayerOperation, OPENCL, OperationType::FlattenLayer)
-{
- ARM_COMPUTE_ERROR_ON(ctx.num_inputs() != 1);
- ARM_COMPUTE_ERROR_ON(ctx.num_outputs() != 1);
- ARM_COMPUTE_ERROR_ON(dynamic_cast<arm_compute::ICLTensor *>(ctx.input(0)) == nullptr);
- ARM_COMPUTE_ERROR_ON(dynamic_cast<arm_compute::ICLTensor *>(ctx.output(0)) == nullptr);
-
- // Extract IO and info
- auto *in = dynamic_cast<arm_compute::ICLTensor *>(ctx.input(0));
- auto *out = dynamic_cast<arm_compute::ICLTensor *>(ctx.output(0));
-
- // Create and configure function
- auto flatten = arm_compute::support::cpp14::make_unique<arm_compute::CLFlattenLayer>();
- flatten->configure(in, out);
-
- // Log info
- ARM_COMPUTE_LOG_GRAPH_INFO("Instantiating CLFlattenLayer"
- << " Data Type: " << in->info()->data_type()
- << " Input shape: " << in->info()->tensor_shape()
- << " Output shape: " << out->info()->tensor_shape()
- << std::endl);
-
- return std::move(flatten);
-}
-
-/* Floor Layer */
-REGISTER_SIMPLE_OPERATION(CLFloorLayerOperation, OPENCL, OperationType::FloorLayer)
-{
- ARM_COMPUTE_ERROR_ON(ctx.num_inputs() != 1);
- ARM_COMPUTE_ERROR_ON(ctx.num_outputs() != 1);
- ARM_COMPUTE_ERROR_ON(dynamic_cast<arm_compute::ICLTensor *>(ctx.input(0)) == nullptr);
- ARM_COMPUTE_ERROR_ON(dynamic_cast<arm_compute::ICLTensor *>(ctx.output(0)) == nullptr);
-
- // Extract IO and info
- auto *in = dynamic_cast<arm_compute::ICLTensor *>(ctx.input(0));
- auto *out = dynamic_cast<arm_compute::ICLTensor *>(ctx.output(0));
-
- // Create and configure function
- auto floor = arm_compute::support::cpp14::make_unique<arm_compute::CLFloor>();
- floor->configure(in, out);
-
- // Log info
- ARM_COMPUTE_LOG_GRAPH_INFO("Instantiating CLFloorLayer"
- << " Data Type: " << in->info()->data_type()
- << " Input shape: " << in->info()->tensor_shape()
- << " Output shape: " << out->info()->tensor_shape()
- << std::endl);
-
- return std::move(floor);
-}
-
-/* Fully Connected Layer */
-REGISTER_SIMPLE_OPERATION(CLFullyConnectedLayer, OPENCL, OperationType::FullyConnectedLayer)
-{
- ARM_COMPUTE_ERROR_ON(ctx.num_inputs() != 3);
- ARM_COMPUTE_ERROR_ON(ctx.num_outputs() != 1);
- ARM_COMPUTE_ERROR_ON(dynamic_cast<arm_compute::ICLTensor *>(ctx.input(0)) == nullptr);
- ARM_COMPUTE_ERROR_ON(dynamic_cast<arm_compute::ICLTensor *>(ctx.input(1)) == nullptr);
- ARM_COMPUTE_ERROR_ON(dynamic_cast<arm_compute::ICLTensor *>(ctx.input(2)) == nullptr);
- ARM_COMPUTE_ERROR_ON(dynamic_cast<arm_compute::ICLTensor *>(ctx.output(0)) == nullptr);
-
- // Extract IO and info
- auto *in = dynamic_cast<arm_compute::ICLTensor *>(ctx.input(0));
- auto *weights = dynamic_cast<arm_compute::ICLTensor *>(ctx.input(1));
- auto *biases = dynamic_cast<arm_compute::ICLTensor *>(ctx.input(2));
- auto *out = dynamic_cast<arm_compute::ICLTensor *>(ctx.output(0));
-
- // Create and configure function
- auto fc = arm_compute::support::cpp14::make_unique<arm_compute::CLFullyConnectedLayer>();
- fc->configure(in, weights, biases, out);
-
- // Log info
- ARM_COMPUTE_LOG_GRAPH_INFO("Instantiating CLFullyConnectedLayer"
- << " Data Type: " << in->info()->data_type()
- << " Input shape: " << in->info()->tensor_shape()
- << " Weights shape: " << weights->info()->tensor_shape()
- << " Biases Shape: " << biases->info()->tensor_shape()
- << " Output shape: " << out->info()->tensor_shape()
- << std::endl);
-
- return std::move(fc);
-}
-
-/* L2 Normalize Layer */
-REGISTER_SIMPLE_OPERATION(CLL2NormalizeLayerOperation, OPENCL, OperationType::L2NormalizeLayer)
-{
- ARM_COMPUTE_ERROR_ON(ctx.num_inputs() != 1);
- ARM_COMPUTE_ERROR_ON(ctx.num_outputs() != 1);
- ARM_COMPUTE_ERROR_ON(dynamic_cast<arm_compute::ICLTensor *>(ctx.input(0)) == nullptr);
- ARM_COMPUTE_ERROR_ON(dynamic_cast<arm_compute::ICLTensor *>(ctx.output(0)) == nullptr);
-
- // Extract IO and info
- auto *in = dynamic_cast<arm_compute::ICLTensor *>(ctx.input(0));
- auto *out = dynamic_cast<arm_compute::ICLTensor *>(ctx.output(0));
- const auto axis = ctx.parameter<unsigned int>("axis");
- const auto epsilon = ctx.parameter<float>("epsilon");
-
- // Create and configure function
- auto l2_norm = arm_compute::support::cpp14::make_unique<arm_compute::CLL2NormalizeLayer>();
- l2_norm->configure(in, out, axis, epsilon);
-
- // Log info
- ARM_COMPUTE_LOG_GRAPH_INFO("Instantiating CLL2NormalizeLayer"
- << " Data Type: " << in->info()->data_type()
- << " Input shape: " << in->info()->tensor_shape()
- << " Output shape: " << out->info()->tensor_shape()
- << " Axis: " << axis
- << " Epsilon: " << epsilon
- << std::endl);
-
- return std::move(l2_norm);
-}
-
-/* Normalization Layer */
-REGISTER_SIMPLE_OPERATION(CLNormalizationLayerOperation, OPENCL, OperationType::NormalizationLayer)
-{
- ARM_COMPUTE_ERROR_ON(ctx.num_inputs() != 1);
- ARM_COMPUTE_ERROR_ON(ctx.num_outputs() != 1);
- ARM_COMPUTE_ERROR_ON(dynamic_cast<arm_compute::ICLTensor *>(ctx.input(0)) == nullptr);
- ARM_COMPUTE_ERROR_ON(dynamic_cast<arm_compute::ICLTensor *>(ctx.output(0)) == nullptr);
-
- // Extract IO and info
- auto *in = dynamic_cast<arm_compute::ICLTensor *>(ctx.input(0));
- auto *out = dynamic_cast<arm_compute::ICLTensor *>(ctx.output(0));
- const auto norm_info = ctx.parameter<NormalizationLayerInfo>("NormalizationLayerInfo");
-
- // Create and configure function
- auto norm = arm_compute::support::cpp14::make_unique<arm_compute::CLNormalizationLayer>();
- norm->configure(in, out, norm_info);
-
- // Log info
- ARM_COMPUTE_LOG_GRAPH_INFO("Instantiating CLNormalizationLayer"
- << " Data Type: " << in->info()->data_type()
- << " Input shape: " << in->info()->tensor_shape()
- << " Output shape: " << out->info()->tensor_shape()
- << " Normalization info: " << norm_info
- << std::endl);
-
- return std::move(norm);
-}
-
-/* Pooling Layer */
-REGISTER_SIMPLE_OPERATION(CLPoolingLayerOperation, OPENCL, OperationType::PoolingLayer)
-{
- ARM_COMPUTE_ERROR_ON(ctx.num_inputs() != 1);
- ARM_COMPUTE_ERROR_ON(ctx.num_outputs() != 1);
- ARM_COMPUTE_ERROR_ON(dynamic_cast<arm_compute::ICLTensor *>(ctx.input(0)) == nullptr);
- ARM_COMPUTE_ERROR_ON(dynamic_cast<arm_compute::ICLTensor *>(ctx.output(0)) == nullptr);
-
- // Extract IO and info
- auto *in = dynamic_cast<arm_compute::ICLTensor *>(ctx.input(0));
- auto *out = dynamic_cast<arm_compute::ICLTensor *>(ctx.output(0));
- const auto pool_info = ctx.parameter<PoolingLayerInfo>("PoolingLayerInfo");
-
- // Create and configure function
- auto pool = arm_compute::support::cpp14::make_unique<arm_compute::CLPoolingLayer>();
- pool->configure(in, out, pool_info);
-
- // Log info
- ARM_COMPUTE_LOG_GRAPH_INFO("Instantiating CLPoolingLayer"
- << " Data Type: " << in->info()->data_type()
- << " Input shape: " << in->info()->tensor_shape()
- << " Output shape: " << out->info()->tensor_shape()
- << " Pooling info: " << pool_info
- << std::endl);
-
- return std::move(pool);
-}
-
-/* Quantization Layer */
-REGISTER_SIMPLE_OPERATION(CLQuantizationLayerOperation, OPENCL, OperationType::QuantizationLayer)
-{
- ARM_COMPUTE_ERROR_ON(ctx.num_inputs() != 1);
- ARM_COMPUTE_ERROR_ON(ctx.num_outputs() != 1);
- ARM_COMPUTE_ERROR_ON(dynamic_cast<arm_compute::ICLTensor *>(ctx.input(0)) == nullptr);
- ARM_COMPUTE_ERROR_ON(dynamic_cast<arm_compute::ICLTensor *>(ctx.output(0)) == nullptr);
-
- // Extract IO and info
- auto *in = dynamic_cast<arm_compute::ICLTensor *>(ctx.input(0));
- auto *out = dynamic_cast<arm_compute::ICLTensor *>(ctx.output(0));
-
- // Create and configure function
- auto quantization = arm_compute::support::cpp14::make_unique<arm_compute::CLQuantizationLayer>();
- quantization->configure(in, out);
-
- // Log info
- ARM_COMPUTE_LOG_GRAPH_INFO("Instantiating CLQuantizationLayer"
- << " Data Type: " << in->info()->data_type()
- << " Input shape: " << in->info()->tensor_shape()
- << " Output shape: " << out->info()->tensor_shape()
- << std::endl);
-
- return std::move(quantization);
-}
-
-/* Reshape Layer */
-REGISTER_SIMPLE_OPERATION(CLReshapeLayerOperation, OPENCL, OperationType::ReshapeLayer)
-{
- ARM_COMPUTE_ERROR_ON(ctx.num_inputs() != 1);
- ARM_COMPUTE_ERROR_ON(ctx.num_outputs() != 1);
- ARM_COMPUTE_ERROR_ON(dynamic_cast<arm_compute::ICLTensor *>(ctx.input(0)) == nullptr);
- ARM_COMPUTE_ERROR_ON(dynamic_cast<arm_compute::ICLTensor *>(ctx.output(0)) == nullptr);
-
- // Extract IO and info
- auto *in = dynamic_cast<arm_compute::ICLTensor *>(ctx.input(0));
- auto *out = dynamic_cast<arm_compute::ICLTensor *>(ctx.output(0));
-
- // Create and configure function
- auto reshape = arm_compute::support::cpp14::make_unique<arm_compute::CLReshapeLayer>();
- reshape->configure(in, out);
-
- // Log info
- ARM_COMPUTE_LOG_GRAPH_INFO("Instantiating CLReshapeLayer"
- << " Data Type: " << in->info()->data_type()
- << " Input shape: " << in->info()->tensor_shape()
- << " Output shape: " << out->info()->tensor_shape()
- << std::endl);
-
- return std::move(reshape);
-}
-
-/* Softmax Layer */
-REGISTER_SIMPLE_OPERATION(CLSoftmaxLayerOperation, OPENCL, OperationType::SoftmaxLayer)
-{
- ARM_COMPUTE_ERROR_ON(ctx.num_inputs() != 1);
- ARM_COMPUTE_ERROR_ON(ctx.num_outputs() != 1);
- ARM_COMPUTE_ERROR_ON(dynamic_cast<arm_compute::ICLTensor *>(ctx.input(0)) == nullptr);
- ARM_COMPUTE_ERROR_ON(dynamic_cast<arm_compute::ICLTensor *>(ctx.output(0)) == nullptr);
-
- // Extract IO and info
- auto *in = dynamic_cast<arm_compute::ICLTensor *>(ctx.input(0));
- auto *out = dynamic_cast<arm_compute::ICLTensor *>(ctx.output(0));
-
- // Create and configure function
- auto smx = arm_compute::support::cpp14::make_unique<arm_compute::CLSoftmaxLayer>();
- smx->configure(in, out);
-
- // Log info
- ARM_COMPUTE_LOG_GRAPH_INFO("Instantiating CLSoftmaxLayer"
- << " Data Type: " << in->info()->data_type()
- << " Input shape: " << in->info()->tensor_shape()
- << " Output shape: " << out->info()->tensor_shape()
- << std::endl);
-
- return std::move(smx);
-}
diff --git a/src/graph/operations/NESimpleOperations.cpp b/src/graph/operations/NESimpleOperations.cpp
deleted file mode 100644
index 4154b9a59c..0000000000
--- a/src/graph/operations/NESimpleOperations.cpp
+++ /dev/null
@@ -1,495 +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.
- */
-#include "arm_compute/core/Error.h"
-#include "arm_compute/core/ITensor.h"
-#include "arm_compute/graph/IOperation.h"
-#include "arm_compute/graph/NodeContext.h"
-#include "arm_compute/graph/OperationRegistrar.h"
-#include "arm_compute/graph/Types.h"
-#include "arm_compute/runtime/NEON/NEFunctions.h"
-#include "support/ToolchainSupport.h"
-#include "utils/GraphTypePrinter.h"
-#include "utils/TypePrinter.h"
-
-#include <memory>
-
-using namespace arm_compute::graph;
-
-/* Activation Layer */
-REGISTER_SIMPLE_OPERATION(NEActivationLayerOperation, NEON, OperationType::ActivationLayer)
-{
- ARM_COMPUTE_ERROR_ON(ctx.num_inputs() != 1);
- ARM_COMPUTE_ERROR_ON(ctx.num_outputs() != 1);
- ARM_COMPUTE_ERROR_ON(dynamic_cast<arm_compute::ITensor *>(ctx.input(0)) == nullptr);
- ARM_COMPUTE_ERROR_ON(dynamic_cast<arm_compute::ITensor *>(ctx.output(0)) == nullptr);
-
- // Extract IO and info
- auto *in = dynamic_cast<arm_compute::ITensor *>(ctx.input(0));
- auto *out = dynamic_cast<arm_compute::ITensor *>(ctx.output(0));
- const auto act_info = ctx.parameter<ActivationLayerInfo>("ActivationLayerInfo");
-
- // Create and configure function
- auto activation = arm_compute::support::cpp14::make_unique<arm_compute::NEActivationLayer>();
- activation->configure(in, out, act_info);
-
- // Log info
- ARM_COMPUTE_LOG_GRAPH_INFO("Instantiating NEActivationLayer"
- << " Data Type: " << in->info()->data_type()
- << " Input shape: " << in->info()->tensor_shape()
- << " Output shape: " << out->info()->tensor_shape()
- << " Activation function: " << act_info.activation()
- << " a: " << act_info.a()
- << " b: " << act_info.b()
- << std::endl);
-
- return std::move(activation);
-}
-
-/* Arithmetic addition */
-REGISTER_SIMPLE_OPERATION(NEArithmeticAdditionOperation, NEON, OperationType::ArithmeticAddition)
-{
- ARM_COMPUTE_ERROR_ON(ctx.num_inputs() != 2);
- ARM_COMPUTE_ERROR_ON(ctx.num_outputs() != 1);
- ARM_COMPUTE_ERROR_ON(dynamic_cast<arm_compute::ITensor *>(ctx.input(0)) == nullptr);
- ARM_COMPUTE_ERROR_ON(dynamic_cast<arm_compute::ITensor *>(ctx.input(1)) == nullptr);
- ARM_COMPUTE_ERROR_ON(dynamic_cast<arm_compute::ITensor *>(ctx.output(0)) == nullptr);
-
- // Extract IO and info
- auto *in1 = dynamic_cast<arm_compute::ITensor *>(ctx.input(0));
- auto *in2 = dynamic_cast<arm_compute::ITensor *>(ctx.input(1));
- auto *out = dynamic_cast<arm_compute::ITensor *>(ctx.output(0));
-
- auto addition = arm_compute::support::cpp14::make_unique<arm_compute::NEArithmeticAddition>();
- addition->configure(in1, in2, out, ConvertPolicy::SATURATE);
-
- // Log info
- ARM_COMPUTE_LOG_GRAPH_INFO("Instantiating NEArithmeticAddition"
- << " Data Type: " << in1->info()->data_type()
- << " Input 1 shape: " << in1->info()->tensor_shape()
- << " Input 2 shape: " << in2->info()->tensor_shape()
- << " Output shape: " << out->info()->tensor_shape()
- << std::endl);
-
- return std::move(addition);
-}
-
-/* Batch Normalization Layer */
-REGISTER_SIMPLE_OPERATION(NEBatchNormalizationLayerOperation, NEON, OperationType::BatchNormalizationLayer)
-{
- ARM_COMPUTE_ERROR_ON(ctx.num_inputs() != 5);
- ARM_COMPUTE_ERROR_ON(ctx.num_outputs() != 1);
- ARM_COMPUTE_ERROR_ON(dynamic_cast<arm_compute::ITensor *>(ctx.input(0)) == nullptr);
- ARM_COMPUTE_ERROR_ON(dynamic_cast<arm_compute::ITensor *>(ctx.input(1)) == nullptr);
- ARM_COMPUTE_ERROR_ON(dynamic_cast<arm_compute::ITensor *>(ctx.input(2)) == nullptr);
- ARM_COMPUTE_ERROR_ON(dynamic_cast<arm_compute::ITensor *>(ctx.input(3)) == nullptr);
- ARM_COMPUTE_ERROR_ON(dynamic_cast<arm_compute::ITensor *>(ctx.input(4)) == nullptr);
- ARM_COMPUTE_ERROR_ON(dynamic_cast<arm_compute::ITensor *>(ctx.output(0)) == nullptr);
-
- // Extract IO and info
- auto *in = dynamic_cast<arm_compute::ITensor *>(ctx.input(0));
- auto *mean = dynamic_cast<arm_compute::ITensor *>(ctx.input(1));
- auto *var = dynamic_cast<arm_compute::ITensor *>(ctx.input(2));
- auto *beta = dynamic_cast<arm_compute::ITensor *>(ctx.input(3));
- auto *gamma = dynamic_cast<arm_compute::ITensor *>(ctx.input(4));
- auto *out = dynamic_cast<arm_compute::ITensor *>(ctx.output(0));
- const auto epsilon = ctx.parameter<float>("epsilon");
- const auto act_info = ctx.parameter<ActivationLayerInfo>("act_info");
-
- // Create and configure function
- auto batch_norm = arm_compute::support::cpp14::make_unique<arm_compute::NEBatchNormalizationLayer>();
- batch_norm->configure(in, out, mean, var, beta, gamma, epsilon, act_info);
-
- // Log info
- ARM_COMPUTE_LOG_GRAPH_INFO("Instantiating NEBatchNormalizationLayer"
- << " Data Type: " << in->info()->data_type()
- << " Input shape: " << in->info()->tensor_shape()
- << " Output shape: " << out->info()->tensor_shape()
- << " Mean shape: " << mean->info()->tensor_shape()
- << " Var shape: " << var->info()->tensor_shape()
- << " Beta shape: " << beta->info()->tensor_shape()
- << " Gamma shape: " << gamma->info()->tensor_shape()
- << " Epsilon: " << epsilon
- << " Activation function: " << act_info.activation()
- << " a: " << act_info.a()
- << " b: " << act_info.b()
- << std::endl);
-
- return std::move(batch_norm);
-}
-
-/* DepthConvertLayer Layer */
-REGISTER_SIMPLE_OPERATION(NEDepthConvertLayerOperation, NEON, OperationType::DepthConvertLayer)
-{
- ARM_COMPUTE_ERROR_ON(ctx.num_inputs() != 1);
- ARM_COMPUTE_ERROR_ON(ctx.num_outputs() != 1);
- ARM_COMPUTE_ERROR_ON(dynamic_cast<arm_compute::ITensor *>(ctx.input(0)) == nullptr);
- ARM_COMPUTE_ERROR_ON(dynamic_cast<arm_compute::ITensor *>(ctx.output(0)) == nullptr);
-
- // Extract IO and info
- auto *in = dynamic_cast<arm_compute::ITensor *>(ctx.input(0));
- auto *out = dynamic_cast<arm_compute::ITensor *>(ctx.output(0));
- const auto conv_policy = ctx.parameter<ConvertPolicy>("ConvertPolicy");
- const auto shift = ctx.parameter<uint32_t>("shift");
-
- // Create and configure function
- auto depthconvert = arm_compute::support::cpp14::make_unique<arm_compute::NEDepthConvertLayer>();
- depthconvert->configure(in, out, conv_policy, shift);
-
- // Log info
- ARM_COMPUTE_LOG_GRAPH_INFO("Instantiating NEDepthConvertLayer"
- << " Data Type: " << in->info()->data_type()
- << " Input shape: " << in->info()->tensor_shape()
- << " Output shape: " << out->info()->tensor_shape()
- << " shift: " << shift
- << std::endl);
-
- return std::move(depthconvert);
-}
-
-/* DepthwiseConvolutionLayer Layer */
-REGISTER_SIMPLE_OPERATION(NEDepthwiseConvolutionOperation, NEON, OperationType::DepthwiseConvolutionLayer)
-{
- ARM_COMPUTE_ERROR_ON(ctx.num_inputs() != 2 && ctx.num_inputs() != 3);
- ARM_COMPUTE_ERROR_ON(ctx.num_outputs() != 1);
- ARM_COMPUTE_ERROR_ON(dynamic_cast<arm_compute::ITensor *>(ctx.input(0)) == nullptr);
- ARM_COMPUTE_ERROR_ON(dynamic_cast<arm_compute::ITensor *>(ctx.output(0)) == nullptr);
-
- // Extract IO and info
- auto *in = dynamic_cast<arm_compute::ITensor *>(ctx.input(0));
- auto *weights = dynamic_cast<arm_compute::ITensor *>(ctx.input(1));
- auto *biases = ctx.num_inputs() == 3 ? dynamic_cast<arm_compute::ITensor *>(ctx.input(2)) : nullptr;
- auto *out = dynamic_cast<arm_compute::ITensor *>(ctx.output(0));
- const auto conv_info = ctx.parameter<PadStrideInfo>("ConvolutionInfo");
- const auto opt3x3 = ctx.parameter<bool>("Optimized3x3");
-
- // Create and configure function
- std::unique_ptr<arm_compute::IFunction> func;
- bool run_3x3_opt = opt3x3 && weights->info()->dimension(0) == 3;
- if(run_3x3_opt)
- {
- auto depwthwise_conv = arm_compute::support::cpp14::make_unique<arm_compute::NEDepthwiseConvolutionLayer3x3>();
- depwthwise_conv->configure(in, weights, biases, out, conv_info);
- func = std::move(depwthwise_conv);
- }
- else
- {
- auto depwthwise_conv = arm_compute::support::cpp14::make_unique<arm_compute::NEDepthwiseConvolutionLayer>();
- depwthwise_conv->configure(in, weights, biases, out, conv_info);
- func = std::move(depwthwise_conv);
- }
-
- // Log info
- ARM_COMPUTE_LOG_GRAPH_INFO("Instantiating NEDepthwiseConvolutionLayer"
- << " Data Type: " << in->info()->data_type()
- << " Input shape: " << in->info()->tensor_shape()
- << " Weights shape: " << weights->info()->tensor_shape()
- << " Output shape: " << out->info()->tensor_shape());
- if(biases == nullptr)
- {
- ARM_COMPUTE_LOG_GRAPH_INFO(" Biases shape: No biases provided" << std::endl);
- }
- else
- {
- ARM_COMPUTE_LOG_GRAPH_INFO(" Biases shape: " << biases->info()->tensor_shape() << std::endl);
- }
-
- return func;
-}
-
-/* DeQuantizationLayer Layer */
-REGISTER_SIMPLE_OPERATION(NEDequantizationLayerOperation, NEON, OperationType::DequantizationLayer)
-{
- ARM_COMPUTE_ERROR_ON(ctx.num_inputs() != 1);
- ARM_COMPUTE_ERROR_ON(ctx.num_outputs() != 2);
- ARM_COMPUTE_ERROR_ON(dynamic_cast<arm_compute::ITensor *>(ctx.input(0)) == nullptr);
- ARM_COMPUTE_ERROR_ON(dynamic_cast<arm_compute::ITensor *>(ctx.output(0)) == nullptr);
- ARM_COMPUTE_ERROR_ON(dynamic_cast<arm_compute::ITensor *>(ctx.output(1)) == nullptr);
-
- // Extract IO and info
- auto *in = dynamic_cast<arm_compute::ITensor *>(ctx.input(0));
- auto *out = dynamic_cast<arm_compute::ITensor *>(ctx.output(0));
- auto *min_max = dynamic_cast<arm_compute::ITensor *>(ctx.output(1));
-
- // Create and configure function
- auto dequantization = arm_compute::support::cpp14::make_unique<arm_compute::NEDequantizationLayer>();
- dequantization->configure(in, out, min_max);
-
- // Log info
- ARM_COMPUTE_LOG_GRAPH_INFO("Instantiating NEDequantizationLayer"
- << " Data Type: " << in->info()->data_type()
- << " Input shape: " << in->info()->tensor_shape()
- << " Output shape: " << out->info()->tensor_shape()
- << " Min max shape: " << min_max->info()->tensor_shape()
- << std::endl);
-
- return std::move(dequantization);
-}
-
-/* Flatten Layer */
-REGISTER_SIMPLE_OPERATION(NEFlattenLayerOperation, NEON, OperationType::FlattenLayer)
-{
- ARM_COMPUTE_ERROR_ON(ctx.num_inputs() != 1);
- ARM_COMPUTE_ERROR_ON(ctx.num_outputs() != 1);
- ARM_COMPUTE_ERROR_ON(dynamic_cast<arm_compute::ITensor *>(ctx.input(0)) == nullptr);
- ARM_COMPUTE_ERROR_ON(dynamic_cast<arm_compute::ITensor *>(ctx.output(0)) == nullptr);
-
- // Extract IO and info
- auto *in = dynamic_cast<arm_compute::ITensor *>(ctx.input(0));
- auto *out = dynamic_cast<arm_compute::ITensor *>(ctx.output(0));
-
- // Create and configure function
- auto flatten = arm_compute::support::cpp14::make_unique<arm_compute::NEFlattenLayer>();
- flatten->configure(in, out);
-
- // Log info
- ARM_COMPUTE_LOG_GRAPH_INFO("Instantiating NEFlattenLayer"
- << " Data Type: " << in->info()->data_type()
- << " Input shape: " << in->info()->tensor_shape()
- << " Output shape: " << out->info()->tensor_shape()
- << std::endl);
-
- return std::move(flatten);
-}
-
-/* Floor Layer */
-REGISTER_SIMPLE_OPERATION(NEFloorLayerOperation, NEON, OperationType::FloorLayer)
-{
- ARM_COMPUTE_ERROR_ON(ctx.num_inputs() != 1);
- ARM_COMPUTE_ERROR_ON(ctx.num_outputs() != 1);
- ARM_COMPUTE_ERROR_ON(dynamic_cast<arm_compute::ITensor *>(ctx.input(0)) == nullptr);
- ARM_COMPUTE_ERROR_ON(dynamic_cast<arm_compute::ITensor *>(ctx.output(0)) == nullptr);
-
- // Extract IO and info
- auto *in = dynamic_cast<arm_compute::ITensor *>(ctx.input(0));
- auto *out = dynamic_cast<arm_compute::ITensor *>(ctx.output(0));
-
- // Create and configure function
- auto floor = arm_compute::support::cpp14::make_unique<arm_compute::NEFloor>();
- floor->configure(in, out);
-
- // Log info
- ARM_COMPUTE_LOG_GRAPH_INFO("Instantiating NEFloorLayer"
- << " Data Type: " << in->info()->data_type()
- << " Input shape: " << in->info()->tensor_shape()
- << " Output shape: " << out->info()->tensor_shape()
- << std::endl);
-
- return std::move(floor);
-}
-
-/* Fully Connected Layer */
-REGISTER_SIMPLE_OPERATION(NEFullyConnectedLayer, NEON, OperationType::FullyConnectedLayer)
-{
- ARM_COMPUTE_ERROR_ON(ctx.num_inputs() != 3);
- ARM_COMPUTE_ERROR_ON(ctx.num_outputs() != 1);
- ARM_COMPUTE_ERROR_ON(dynamic_cast<arm_compute::ITensor *>(ctx.input(0)) == nullptr);
- ARM_COMPUTE_ERROR_ON(dynamic_cast<arm_compute::ITensor *>(ctx.input(1)) == nullptr);
- ARM_COMPUTE_ERROR_ON(dynamic_cast<arm_compute::ITensor *>(ctx.input(2)) == nullptr);
- ARM_COMPUTE_ERROR_ON(dynamic_cast<arm_compute::ITensor *>(ctx.output(0)) == nullptr);
-
- // Extract IO and info
- auto *in = dynamic_cast<arm_compute::ITensor *>(ctx.input(0));
- auto *weights = dynamic_cast<arm_compute::ITensor *>(ctx.input(1));
- auto *biases = dynamic_cast<arm_compute::ITensor *>(ctx.input(2));
- auto *out = dynamic_cast<arm_compute::ITensor *>(ctx.output(0));
-
- // Create and configure function
- auto fc = arm_compute::support::cpp14::make_unique<arm_compute::NEFullyConnectedLayer>();
- fc->configure(in, weights, biases, out);
-
- // Log info
- ARM_COMPUTE_LOG_GRAPH_INFO("Instantiating NEFullyConnectedLayer"
- << " Data Type: " << in->info()->data_type()
- << " Input shape: " << in->info()->tensor_shape()
- << " Weights shape: " << weights->info()->tensor_shape()
- << " Biases Shape: " << biases->info()->tensor_shape()
- << " Output shape: " << out->info()->tensor_shape()
- << std::endl);
-
- return std::move(fc);
-}
-
-/* L2 Normalize Layer */
-REGISTER_SIMPLE_OPERATION(NEL2NormalizeLayerOperation, NEON, OperationType::L2NormalizeLayer)
-{
- ARM_COMPUTE_ERROR_ON(ctx.num_inputs() != 1);
- ARM_COMPUTE_ERROR_ON(ctx.num_outputs() != 1);
- ARM_COMPUTE_ERROR_ON(dynamic_cast<arm_compute::ITensor *>(ctx.input(0)) == nullptr);
- ARM_COMPUTE_ERROR_ON(dynamic_cast<arm_compute::ITensor *>(ctx.output(0)) == nullptr);
-
- // Extract IO and info
- auto *in = dynamic_cast<arm_compute::ITensor *>(ctx.input(0));
- auto *out = dynamic_cast<arm_compute::ITensor *>(ctx.output(0));
- const auto axis = ctx.parameter<unsigned int>("axis");
- const auto epsilon = ctx.parameter<float>("epsilon");
-
- // Create and configure function
- auto l2_norm = arm_compute::support::cpp14::make_unique<arm_compute::NEL2NormalizeLayer>();
- l2_norm->configure(in, out, axis, epsilon);
-
- // Log info
- ARM_COMPUTE_LOG_GRAPH_INFO("Instantiating NEL2NormalizeLayer"
- << " Data Type: " << in->info()->data_type()
- << " Input shape: " << in->info()->tensor_shape()
- << " Output shape: " << out->info()->tensor_shape()
- << " Axis: " << axis
- << " Epsilon: " << epsilon
- << std::endl);
-
- return std::move(l2_norm);
-}
-
-/* Normalization Layer */
-REGISTER_SIMPLE_OPERATION(NENormalizationLayerOperation, NEON, OperationType::NormalizationLayer)
-{
- ARM_COMPUTE_ERROR_ON(ctx.num_inputs() != 1);
- ARM_COMPUTE_ERROR_ON(ctx.num_outputs() != 1);
- ARM_COMPUTE_ERROR_ON(dynamic_cast<arm_compute::ITensor *>(ctx.input(0)) == nullptr);
- ARM_COMPUTE_ERROR_ON(dynamic_cast<arm_compute::ITensor *>(ctx.output(0)) == nullptr);
-
- // Extract IO and info
- auto *in = dynamic_cast<arm_compute::ITensor *>(ctx.input(0));
- auto *out = dynamic_cast<arm_compute::ITensor *>(ctx.output(0));
- const auto norm_info = ctx.parameter<NormalizationLayerInfo>("NormalizationLayerInfo");
-
- // Create and configure function
- auto norm = arm_compute::support::cpp14::make_unique<arm_compute::NENormalizationLayer>();
- norm->configure(in, out, norm_info);
-
- // Log info
- ARM_COMPUTE_LOG_GRAPH_INFO("Instantiating NENormalizationLayer"
- << " Data Type: " << in->info()->data_type()
- << " Input shape: " << in->info()->tensor_shape()
- << " Output shape: " << out->info()->tensor_shape()
- << " Normalization info: " << norm_info
- << std::endl);
-
- return std::move(norm);
-}
-
-/* Pooling Layer */
-REGISTER_SIMPLE_OPERATION(NEPoolingLayerOperation, NEON, OperationType::PoolingLayer)
-{
- ARM_COMPUTE_ERROR_ON(ctx.num_inputs() != 1);
- ARM_COMPUTE_ERROR_ON(ctx.num_outputs() != 1);
- ARM_COMPUTE_ERROR_ON(dynamic_cast<arm_compute::ITensor *>(ctx.input(0)) == nullptr);
- ARM_COMPUTE_ERROR_ON(dynamic_cast<arm_compute::ITensor *>(ctx.output(0)) == nullptr);
-
- // Extract IO and info
- auto *in = dynamic_cast<arm_compute::ITensor *>(ctx.input(0));
- auto *out = dynamic_cast<arm_compute::ITensor *>(ctx.output(0));
- const auto pool_info = ctx.parameter<PoolingLayerInfo>("PoolingLayerInfo");
-
- // Create and configure function
- auto pool = arm_compute::support::cpp14::make_unique<arm_compute::NEPoolingLayer>();
- pool->configure(in, out, pool_info);
-
- // Log info
- ARM_COMPUTE_LOG_GRAPH_INFO("Instantiating NEPoolingLayer"
- << " Data Type: " << in->info()->data_type()
- << " Input shape: " << in->info()->tensor_shape()
- << " Output shape: " << out->info()->tensor_shape()
- << " Pooling info: " << pool_info
- << std::endl);
-
- return std::move(pool);
-}
-
-/* Quantization Layer */
-REGISTER_SIMPLE_OPERATION(NEQuantizationLayerOperation, NEON, OperationType::QuantizationLayer)
-{
- ARM_COMPUTE_ERROR_ON(ctx.num_inputs() != 1);
- ARM_COMPUTE_ERROR_ON(ctx.num_outputs() != 1);
- ARM_COMPUTE_ERROR_ON(dynamic_cast<arm_compute::ITensor *>(ctx.input(0)) == nullptr);
- ARM_COMPUTE_ERROR_ON(dynamic_cast<arm_compute::ITensor *>(ctx.output(0)) == nullptr);
-
- // Extract IO and info
- auto *in = dynamic_cast<arm_compute::ITensor *>(ctx.input(0));
- auto *out = dynamic_cast<arm_compute::ITensor *>(ctx.output(0));
-
- // Create and configure function
- auto quantization = arm_compute::support::cpp14::make_unique<arm_compute::NEQuantizationLayer>();
- quantization->configure(in, out);
-
- // Log info
- ARM_COMPUTE_LOG_GRAPH_INFO("Instantiating NEQuantizationLayer"
- << " Data Type: " << in->info()->data_type()
- << " Input shape: " << in->info()->tensor_shape()
- << " Output shape: " << out->info()->tensor_shape()
- << std::endl);
-
- return std::move(quantization);
-}
-
-/* Reshape Layer */
-REGISTER_SIMPLE_OPERATION(NEReshapeLayerOperation, NEON, OperationType::ReshapeLayer)
-{
- ARM_COMPUTE_ERROR_ON(ctx.num_inputs() != 1);
- ARM_COMPUTE_ERROR_ON(ctx.num_outputs() != 1);
- ARM_COMPUTE_ERROR_ON(dynamic_cast<arm_compute::ITensor *>(ctx.input(0)) == nullptr);
- ARM_COMPUTE_ERROR_ON(dynamic_cast<arm_compute::ITensor *>(ctx.output(0)) == nullptr);
-
- // Extract IO and info
- auto *in = dynamic_cast<arm_compute::ITensor *>(ctx.input(0));
- auto *out = dynamic_cast<arm_compute::ITensor *>(ctx.output(0));
-
- // Create and configure function
- auto reshape = arm_compute::support::cpp14::make_unique<arm_compute::NEReshapeLayer>();
- reshape->configure(in, out);
-
- // Log info
- ARM_COMPUTE_LOG_GRAPH_INFO("Instantiating NEReshapeLayer"
- << " Data Type: " << in->info()->data_type()
- << " Input shape: " << in->info()->tensor_shape()
- << " Output shape: " << out->info()->tensor_shape()
- << std::endl);
-
- return std::move(reshape);
-}
-
-/* Softmax Layer */
-REGISTER_SIMPLE_OPERATION(NESoftmaxLayerOperation, NEON, OperationType::SoftmaxLayer)
-{
- ARM_COMPUTE_ERROR_ON(ctx.num_inputs() != 1);
- ARM_COMPUTE_ERROR_ON(ctx.num_outputs() != 1);
- ARM_COMPUTE_ERROR_ON(dynamic_cast<arm_compute::ITensor *>(ctx.input(0)) == nullptr);
- ARM_COMPUTE_ERROR_ON(dynamic_cast<arm_compute::ITensor *>(ctx.output(0)) == nullptr);
-
- // Extract IO and info
- auto *in = dynamic_cast<arm_compute::ITensor *>(ctx.input(0));
- auto *out = dynamic_cast<arm_compute::ITensor *>(ctx.output(0));
-
- // Create and configure function
- auto smx = arm_compute::support::cpp14::make_unique<arm_compute::NESoftmaxLayer>();
- smx->configure(in, out);
-
- // Log info
- ARM_COMPUTE_LOG_GRAPH_INFO("Instantiating NESoftmaxLayer"
- << " Data Type: " << in->info()->data_type()
- << " Input shape: " << in->info()->tensor_shape()
- << " Output shape: " << out->info()->tensor_shape()
- << std::endl);
-
- return std::move(smx);
-}
diff --git a/src/graph2/printers/DotGraphPrinter.cpp b/src/graph/printers/DotGraphPrinter.cpp
index 04987eebe0..47b1bb56bf 100644
--- a/src/graph2/printers/DotGraphPrinter.cpp
+++ b/src/graph/printers/DotGraphPrinter.cpp
@@ -21,17 +21,17 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#include "arm_compute/graph2/printers/DotGraphPrinter.h"
+#include "arm_compute/graph/printers/DotGraphPrinter.h"
#include "arm_compute/core/Error.h"
-#include "arm_compute/graph2/Graph.h"
-#include "arm_compute/graph2/Tensor.h"
-#include "arm_compute/graph2/TypePrinter.h"
-#include "arm_compute/graph2/nodes/Nodes.h"
+#include "arm_compute/graph/Graph.h"
+#include "arm_compute/graph/Tensor.h"
+#include "arm_compute/graph/TypePrinter.h"
+#include "arm_compute/graph/nodes/Nodes.h"
namespace arm_compute
{
-namespace graph2
+namespace graph
{
void DotGraphVisitor::visit(ActivationLayerNode &n)
{
@@ -169,5 +169,5 @@ void DotGraphPrinter::print_edges(const Graph &g, std::ostream &os)
}
}
}
-} // namespace graph2
+} // namespace graph
} // namespace arm_compute
diff --git a/src/graph2/Graph.cpp b/src/graph2/Graph.cpp
deleted file mode 100644
index ead67bc85a..0000000000
--- a/src/graph2/Graph.cpp
+++ /dev/null
@@ -1,227 +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.
- */
-#include "arm_compute/graph2/Graph.h"
-
-namespace arm_compute
-{
-namespace graph2
-{
-Graph::Graph(GraphID id, std::string name)
- : _id(id), _name(std::move(name)), _nodes(), _edges(), _tensors(), _tagged_nodes(), _mtx()
-{
-}
-
-bool Graph::remove_node(NodeID nid)
-{
- if(nid >= _nodes.size())
- {
- return false;
- }
-
- std::unique_ptr<INode> &node = _nodes[nid];
-
- // Remove node connections
- if(node)
- {
- for(auto &input_eid : node->_input_edges)
- {
- remove_connection(input_eid);
- }
- for(auto &outpud_eid : node->_output_edges)
- {
- remove_connection(outpud_eid);
- }
- }
-
- node = nullptr;
-
- return true;
-}
-
-EdgeID Graph::add_connection(NodeID source, size_t source_idx, NodeID sink, size_t sink_idx)
-{
- std::lock_guard<arm_compute::Mutex> lock(_mtx);
-
- // Check if node index is valid, if node exists and finally if the connection index is valid
- ARM_COMPUTE_ERROR_ON((source >= _nodes.size()) || (_nodes[source] == nullptr) || (source_idx >= _nodes[source]->num_outputs()));
- ARM_COMPUTE_ERROR_ON((sink >= _nodes.size()) || (_nodes[sink] == nullptr) || (sink_idx >= _nodes[sink]->num_inputs()));
-
- // Get nodes
- std::unique_ptr<INode> &source_node = _nodes[source];
- std::unique_ptr<INode> &sink_node = _nodes[sink];
-
- // Check for duplicate connections (Check only sink node)
- Edge *sink_node_edge = sink_node->input_edge(sink_idx);
- if((sink_node_edge != nullptr) && (sink_node_edge->producer_id() == source) && (sink_node_edge->producer_idx() == source_idx)
- && (sink_node_edge->consumer_id() == sink) && (sink_node_edge->consumer_idx() == sink_idx))
- {
- return sink_node_edge->id();
- }
-
- // Check if there is already a tensor associated with output if not create one
- TensorID tid = source_node->output_id(source_idx);
- if(tid == NullTensorID)
- {
- tid = create_tensor();
- }
- std::unique_ptr<Tensor> &tensor = _tensors[tid];
-
- // Create connections
- EdgeID eid = _edges.size();
- auto connection = arm_compute::support::cpp14::make_unique<Edge>(eid, source_node.get(), source_idx, sink_node.get(), sink_idx, tensor.get());
- _edges.push_back(std::move(connection));
-
- // Add connections to source and sink nodes
- source_node->_output_edges.insert(eid);
- sink_node->_input_edges[sink_idx] = eid;
-
- // Set tensor output node
- source_node->_outputs[source_idx] = tid;
-
- // Bind tensor to the edge
- tensor->bind_edge(eid);
-
- // Try and propagate shapes in sink node
- sink_node->forward_descriptors();
-
- return eid;
-}
-
-bool Graph::remove_connection(EdgeID eid)
-{
- if(eid >= _edges.size())
- {
- return false;
- }
-
- std::unique_ptr<Edge> &edge = _edges[eid];
-
- // Remove node connections
- if(edge != nullptr)
- {
- // Get tensor bound to the edge
- if(edge->tensor() != nullptr)
- {
- edge->tensor()->unbind_edge(eid);
- }
-
- // Remove edges from source node
- if(edge->producer() != nullptr)
- {
- edge->producer()->_output_edges.erase(eid);
- }
-
- // Remove edges from sink node
- if((edge->consumer() != nullptr) && (edge->consumer_idx() < edge->consumer()->_input_edges.size()))
- {
- edge->consumer()->_input_edges[edge->consumer_idx()] = EmptyEdgeID;
- }
- }
-
- // Clear edge
- edge = nullptr;
-
- return true;
-}
-
-TensorID Graph::create_tensor(TensorDescriptor desc)
-{
- TensorID tid = _tensors.size();
- auto tensor = support::cpp14::make_unique<Tensor>(tid, desc);
- _tensors.push_back(std::move(tensor));
-
- return tid;
-}
-
-std::string Graph::name() const
-{
- return _name;
-}
-
-GraphID Graph::id() const
-{
- return _id;
-}
-
-const std::vector<NodeID> &Graph::inputs()
-{
- return _tagged_nodes[NodeType::Input];
-}
-
-std::vector<std::unique_ptr<INode>> &Graph::nodes()
-{
- return _nodes;
-}
-
-const std::vector<std::unique_ptr<INode>> &Graph::nodes() const
-{
- return _nodes;
-}
-
-const std::vector<std::unique_ptr<Edge>> &Graph::edges() const
-{
- return _edges;
-}
-
-std::vector<std::unique_ptr<Tensor>> &Graph::tensors()
-{
- return _tensors;
-}
-
-const std::vector<std::unique_ptr<Tensor>> &Graph::tensors() const
-{
- return _tensors;
-}
-
-const INode *Graph::node(NodeID id) const
-{
- return (id >= _nodes.size()) ? nullptr : _nodes[id].get();
-}
-
-INode *Graph::node(NodeID id)
-{
- return (id >= _nodes.size()) ? nullptr : _nodes[id].get();
-}
-
-const Edge *Graph::edge(EdgeID id) const
-{
- return (id >= _edges.size()) ? nullptr : _edges[id].get();
-}
-
-Edge *Graph::edge(EdgeID id)
-{
- return (id >= _edges.size()) ? nullptr : _edges[id].get();
-}
-
-const Tensor *Graph::tensor(TensorID id) const
-{
- return (id >= _tensors.size()) ? nullptr : _tensors[id].get();
-}
-
-Tensor *Graph::tensor(TensorID id)
-{
- return (id >= _tensors.size()) ? nullptr : _tensors[id].get();
-}
-} // namespace graph2
-} // namespace arm_compute \ No newline at end of file
diff --git a/src/graph2/GraphContext.cpp b/src/graph2/GraphContext.cpp
deleted file mode 100644
index 08a7b68dce..0000000000
--- a/src/graph2/GraphContext.cpp
+++ /dev/null
@@ -1,74 +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.
- */
-#include "arm_compute/graph2/GraphContext.h"
-#include <arm_compute/graph2.h>
-
-namespace arm_compute
-{
-namespace graph2
-{
-GraphContext::GraphContext()
- : _config(), _memory_managers()
-{
-}
-
-const GraphConfig &GraphContext::config() const
-{
- return _config;
-}
-
-void GraphContext::set_config(const GraphConfig &config)
-{
- _config = config;
-}
-
-bool GraphContext::insert_memory_management_ctx(MemoryManagerContext &&memory_ctx)
-{
- Target target = memory_ctx.target;
- if(target == Target::UNSPECIFIED || _memory_managers.find(target) != std::end(_memory_managers))
- {
- return false;
- }
-
- _memory_managers[target] = std::move(memory_ctx);
- return true;
-}
-
-MemoryManagerContext *GraphContext::memory_management_ctx(Target target)
-{
- return (_memory_managers.find(target) != std::end(_memory_managers)) ? &_memory_managers[target] : nullptr;
-}
-
-void GraphContext::finalize()
-{
- for(auto &mm_obj : _memory_managers)
- {
- if(mm_obj.second.mm != nullptr)
- {
- mm_obj.second.mm->finalize();
- }
- }
-}
-} // namespace graph2
-} // namespace arm_compute \ No newline at end of file
diff --git a/src/graph2/INode.cpp b/src/graph2/INode.cpp
deleted file mode 100644
index 28be341396..0000000000
--- a/src/graph2/INode.cpp
+++ /dev/null
@@ -1,193 +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.
- */
-#include "arm_compute/graph2/INode.h"
-
-#include "arm_compute/core/Error.h"
-#include "arm_compute/graph2/Edge.h"
-#include "arm_compute/graph2/Graph.h"
-#include "arm_compute/graph2/Tensor.h"
-
-namespace arm_compute
-{
-namespace graph2
-{
-// *INDENT-OFF*
-// clang-format off
-INode::INode()
- : _graph(nullptr), _id(EmptyNodeID), _common_params({ "", Target::UNSPECIFIED}),
- _outputs(), _input_edges(), _output_edges(), _assigned_target(Target::UNSPECIFIED)
-{
-}
-// clang-format on
-// *INDENT-ON*
-
-void INode::set_graph(Graph *g)
-{
- ARM_COMPUTE_ERROR_ON(g == nullptr);
- _graph = g;
-}
-
-void INode::set_id(NodeID id)
-{
- _id = id;
-}
-
-void INode::set_common_node_parameters(NodeParams common_params)
-{
- _common_params = std::move(common_params);
-}
-
-void INode::set_requested_target(Target target)
-{
- _common_params.target = target;
-}
-
-void INode::set_assigned_target(Target target)
-{
- _assigned_target = target;
-}
-
-void INode::set_output_tensor(TensorID tid, size_t idx)
-{
- if(tid != NullTensorID && (idx < _outputs.size()) && (_graph->tensor(tid) != nullptr))
- {
- ARM_COMPUTE_ERROR_ON(_graph == nullptr);
- Tensor *updated_tensor = _graph->tensor(tid);
- _outputs[idx] = tid;
-
- // Set tensor to all output edges of the node
- for(auto &output_edge_id : _output_edges)
- {
- auto output_edge = _graph->edge(output_edge_id);
- if(output_edge != nullptr)
- {
- // Unbind edge from current tensor
- auto current_output_tensor = output_edge->tensor();
- current_output_tensor->unbind_edge(output_edge->id());
-
- // Update tensor to edge and rebind tensor
- output_edge->update_bound_tensor(updated_tensor);
- updated_tensor->bind_edge(output_edge->id());
- }
- }
- }
-}
-
-NodeID INode::id() const
-{
- return _id;
-}
-
-std::string INode::name() const
-{
- return _common_params.name;
-}
-
-const Graph *INode::graph() const
-{
- return _graph;
-}
-
-Graph *INode::graph()
-{
- return _graph;
-}
-
-const std::vector<TensorID> &INode::outputs() const
-{
- return _outputs;
-}
-
-const std::vector<EdgeID> &INode::input_edges() const
-{
- return _input_edges;
-}
-
-const std::set<EdgeID> &INode::output_edges() const
-{
- return _output_edges;
-}
-
-TensorID INode::input_id(size_t idx) const
-{
- ARM_COMPUTE_ERROR_ON(idx >= _input_edges.size());
- Edge *e = _graph->edge(_input_edges[idx]);
- return (e != nullptr) ? e->tensor_id() : NullTensorID;
-}
-
-TensorID INode::output_id(size_t idx) const
-{
- ARM_COMPUTE_ERROR_ON(idx >= _outputs.size());
- return _outputs[idx];
-}
-
-Tensor *INode::input(size_t idx) const
-{
- ARM_COMPUTE_ERROR_ON(_graph == nullptr);
- ARM_COMPUTE_ERROR_ON(idx >= _input_edges.size());
- Edge *e = _graph->edge(_input_edges[idx]);
- return (e != nullptr) ? e->tensor() : nullptr;
-}
-
-Tensor *INode::output(size_t idx) const
-{
- ARM_COMPUTE_ERROR_ON(_graph == nullptr);
- ARM_COMPUTE_ERROR_ON(idx >= _outputs.size());
- return _graph->tensor(_outputs[idx]);
-}
-
-EdgeID INode::input_edge_id(size_t idx) const
-{
- ARM_COMPUTE_ERROR_ON(idx >= _input_edges.size());
- return _input_edges[idx];
-}
-
-Edge *INode::input_edge(size_t idx) const
-{
- ARM_COMPUTE_ERROR_ON(_graph == nullptr);
- ARM_COMPUTE_ERROR_ON(idx >= _input_edges.size());
- return _graph->edge(_input_edges[idx]);
-}
-
-size_t INode::num_inputs() const
-{
- return _input_edges.size();
-}
-
-size_t INode::num_outputs() const
-{
- return _outputs.size();
-}
-
-Target INode::requested_target() const
-{
- return _common_params.target;
-}
-
-Target INode::assigned_target() const
-{
- return _assigned_target;
-}
-} // namespace graph2
-} // namespace arm_compute \ No newline at end of file
diff --git a/src/graph2/Tensor.cpp b/src/graph2/Tensor.cpp
deleted file mode 100644
index c6054d716d..0000000000
--- a/src/graph2/Tensor.cpp
+++ /dev/null
@@ -1,111 +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.
- */
-#include "arm_compute/graph2/Tensor.h"
-
-namespace arm_compute
-{
-namespace graph2
-{
-Tensor::Tensor(TensorID id, TensorDescriptor desc)
- : _id(id), _desc(desc), _handle(nullptr), _accessor(nullptr), _bound_edges()
-{
-}
-
-TensorID Tensor::id() const
-{
- return _id;
-}
-
-TensorDescriptor &Tensor::desc()
-{
- return _desc;
-}
-
-const TensorDescriptor &Tensor::desc() const
-{
- return _desc;
-}
-
-void Tensor::set_handle(std::unique_ptr<ITensorHandle> backend_tensor)
-{
- _handle = std::move(backend_tensor);
-}
-
-ITensorHandle *Tensor::handle()
-{
- return _handle.get();
-}
-
-void Tensor::set_accessor(std::unique_ptr<ITensorAccessor> accessor)
-{
- _accessor = std::move(accessor);
-}
-
-ITensorAccessor *Tensor::accessor()
-{
- return _accessor.get();
-}
-
-bool Tensor::call_accessor()
-{
- // Early exit guard
- if(!_accessor || !_handle)
- {
- return false;
- }
-
- // Map tensor
- _handle->map(true);
-
- // Return in case of null backend buffer
- if(_handle->tensor().buffer() == nullptr)
- {
- return false;
- }
-
- // Call accessor
- _accessor->access_tensor(_handle->tensor());
-
- // Unmap tensor
- _handle->unmap();
-
- return true;
-}
-
-void Tensor::bind_edge(EdgeID eid)
-{
- _bound_edges.insert(eid);
-}
-
-void Tensor::unbind_edge(EdgeID eid)
-{
- _bound_edges.erase(eid);
-}
-
-const std::set<EdgeID> Tensor::bound_edges() const
-{
- return _bound_edges;
-}
-} // namespace graph2
-} // namespace arm_compute \ No newline at end of file
diff --git a/src/graph2/nodes/FullyConnectedLayer.cpp b/src/graph2/nodes/FullyConnectedLayer.cpp
deleted file mode 100644
index 195adc40fe..0000000000
--- a/src/graph2/nodes/FullyConnectedLayer.cpp
+++ /dev/null
@@ -1,107 +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.
- */
-#include "arm_compute/graph2/nodes/FullyConnectedLayerNode.h"
-
-#include "arm_compute/core/Utils.h"
-#include "arm_compute/graph2/Graph.h"
-#include "arm_compute/graph2/INodeVisitor.h"
-
-namespace arm_compute
-{
-namespace graph2
-{
-FullyConnectedLayerNode::FullyConnectedLayerNode(unsigned int num_outputs)
- : _num_outputs(num_outputs)
-{
- _input_edges.resize(3, EmptyEdgeID);
- _outputs.resize(1, NullTensorID);
-}
-
-TensorShape FullyConnectedLayerNode::compute_weights_shape(TensorShape input_shape, unsigned int num_outputs)
-{
- unsigned int num_weights = 1;
- unsigned int num_dimensions = input_shape.num_dimensions();
- // Ignore the batch dimension if there is one:
- if(num_dimensions == 2 || num_dimensions == 4)
- {
- num_dimensions--;
- }
- for(unsigned int i = 0; i < num_dimensions; i++)
- {
- num_weights *= input_shape[i];
- }
- return TensorShape(num_weights, num_outputs);
-}
-
-TensorShape FullyConnectedLayerNode::compute_output_shape(TensorShape input_shape, unsigned int num_outputs)
-{
- // Note: Only 1D batch space is supported at the moment
- unsigned int batches = input_shape[1];
- if(input_shape.num_dimensions() > 2)
- {
- batches = input_shape[3];
- }
- return TensorShape(num_outputs, batches);
-}
-
-bool FullyConnectedLayerNode::forward_descriptors()
-{
- if((input_id(0) != NullTensorID) && (output_id(0) != NullTensorID))
- {
- Tensor *dst = output(0);
- ARM_COMPUTE_ERROR_ON(dst == nullptr);
- dst->desc() = configure_output(0);
- return true;
- }
- return false;
-}
-
-TensorDescriptor FullyConnectedLayerNode::configure_output(size_t idx) const
-{
- ARM_COMPUTE_UNUSED(idx);
- const Tensor *src = input(0);
- ARM_COMPUTE_ERROR_ON(src == nullptr);
-
- TensorDescriptor output_info = src->desc();
- TensorShape output_shape = compute_output_shape(src->desc().shape, _num_outputs);
- output_info.shape = output_shape;
- return output_info;
-}
-
-Status FullyConnectedLayerNode::validate()
-{
- return Status{};
-}
-
-NodeType FullyConnectedLayerNode::type() const
-{
- return NodeType::FullyConnectedLayer;
-}
-
-void FullyConnectedLayerNode::accept(INodeVisitor &v)
-{
- v.visit(*this);
-}
-} // namespace graph2
-} // namespace arm_compute \ No newline at end of file
diff --git a/src/graph2/nodes/ReshapeLayer.cpp b/src/graph2/nodes/ReshapeLayer.cpp
deleted file mode 100644
index 6280eea75c..0000000000
--- a/src/graph2/nodes/ReshapeLayer.cpp
+++ /dev/null
@@ -1,81 +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.
- */
-#include "arm_compute/graph2/nodes/ReshapeLayerNode.h"
-
-#include "arm_compute/graph2/Graph.h"
-#include "arm_compute/graph2/INodeVisitor.h"
-
-namespace arm_compute
-{
-namespace graph2
-{
-ReshapeLayerNode::ReshapeLayerNode(TensorShape shape)
- : _shape(shape)
-{
- _input_edges.resize(1, EmptyEdgeID);
- _outputs.resize(1, NullTensorID);
-}
-
-bool ReshapeLayerNode::forward_descriptors()
-{
- if((input_id(0) != NullTensorID) && (output_id(0) != NullTensorID))
- {
- Tensor *dst = output(0);
- ARM_COMPUTE_ERROR_ON(dst == nullptr);
- dst->desc() = configure_output(0);
- return true;
- }
- return false;
-}
-
-TensorDescriptor ReshapeLayerNode::configure_output(size_t idx) const
-{
- ARM_COMPUTE_UNUSED(idx);
- ARM_COMPUTE_ERROR_ON(idx >= _outputs.size());
-
- const Tensor *src = input(0);
- ARM_COMPUTE_ERROR_ON(src == nullptr);
-
- TensorDescriptor output_desc = src->desc();
- output_desc.shape = _shape;
-
- return output_desc;
-}
-
-Status ReshapeLayerNode::validate()
-{
- return Status{};
-}
-
-NodeType ReshapeLayerNode::type() const
-{
- return NodeType::ReshapeLayer;
-}
-
-void ReshapeLayerNode::accept(INodeVisitor &v)
-{
- v.visit(*this);
-}
-} // namespace graph2
-} // namespace arm_compute \ No newline at end of file
diff --git a/src/runtime/NEON/functions/NEWinogradLayer.cpp b/src/runtime/NEON/functions/NEWinogradLayer.cpp
index 0ac6d0966d..0a344f0cae 100644
--- a/src/runtime/NEON/functions/NEWinogradLayer.cpp
+++ b/src/runtime/NEON/functions/NEWinogradLayer.cpp
@@ -248,7 +248,7 @@ void NEWinogradLayer::run()
Status NEWinogradLayer::validate(const ITensorInfo *input, const ITensorInfo *weights, const ITensorInfo *biases, const ITensorInfo *output, const PadStrideInfo &conv_info)
{
ARM_COMPUTE_ERROR_ON_NULLPTR(input, weights, biases, output);
- ARM_COMPUTE_RETURN_ERROR_ON(validate_arguments(input, weights, biases, output, conv_info));
+ ARM_COMPUTE_RETURN_ON_ERROR(validate_arguments(input, weights, biases, output, conv_info));
return Status{};
}
diff --git a/tests/SConscript b/tests/SConscript
index 4a4f1bf5dc..20095e56fb 100644
--- a/tests/SConscript
+++ b/tests/SConscript
@@ -74,7 +74,6 @@ if env['internal_only']:
test_env.Append(CPPPATH = ["#3rdparty/include"])
test_env.Append(LIBPATH = ["#3rdparty/%s/%s" % (env['os'], env['arch'])])
test_env.Append(LIBPATH = ["#build/%s" % env['build_dir']])
-test_env.Append(LIBPATH = ["#build/%s/opencl-1.2-stubs" % env['build_dir']])
common_files = Glob('*.cpp')
common_objects = [test_env.StaticObject(f) for f in common_files]
@@ -94,11 +93,9 @@ filter_pattern = test_env['test_filter']
files_validation += Glob('validation/CPP/' + filter_pattern)
if env['opencl']:
- Import('opencl')
filter_pattern = test_env['test_filter']
test_env.Append(CPPDEFINES=['ARM_COMPUTE_CL'])
- test_env.Append(LIBS = ["OpenCL"])
files_benchmark += Glob('benchmark/CL/*/' + filter_pattern)
files_benchmark += Glob('benchmark/CL/' + filter_pattern)
@@ -115,17 +112,6 @@ if env['neon']:
files_validation += Glob('validation/NEON/' + filter_pattern)
if env['gles_compute']:
- if env['os'] != 'android':
- Import('egl')
- Import('glesv2')
-
- test_env.Append(LIBS = ["EGL", "GLESv2"])
- else:
- if env['arch'] != 'armv7a':
- test_env.Append(LIBS = ["EGL", "GLESv3"])
- else:
- test_env.Append(LIBS = ["EGL", "GLESv2"])
-
test_env.Append(CPPDEFINES=['ARM_COMPUTE_GC'])
files_benchmark += Glob('benchmark/GLES_COMPUTE/*/*.cpp')
@@ -143,13 +129,6 @@ if test_env['benchmark_tests']:
arm_compute_benchmark = test_env.Program('arm_compute_benchmark', files_benchmark + common_objects)
Depends(arm_compute_benchmark, arm_compute_test_framework)
Depends(arm_compute_benchmark, arm_compute_lib)
-
- if env['opencl']:
- Depends(arm_compute_benchmark, opencl)
- if env['gles_compute'] and env['os'] != 'android':
- Depends(arm_compute_benchmark, egl)
- Depends(arm_compute_benchmark, glesv2)
-
Default(arm_compute_benchmark)
Export('arm_compute_benchmark')
@@ -158,12 +137,6 @@ if test_env['validation_tests']:
Depends(arm_compute_validation, arm_compute_test_framework)
Depends(arm_compute_validation, arm_compute_lib)
- if env['opencl']:
- Depends(arm_compute_validation, opencl)
- if env['gles_compute'] and env['os'] != 'android':
- Depends(arm_compute_validation, egl)
- Depends(arm_compute_validation, glesv2)
-
Default(arm_compute_validation)
Export('arm_compute_validation')
@@ -182,29 +155,26 @@ if test_env['validation_tests']:
files += Glob("validate_examples/neoncl_*.cpp")
for file in files:
example = "validate_" + os.path.basename(os.path.splitext(str(file))[0])
- cl_examples += [ test_env.Program(example, [ test_env.Object(source=file, target=example) ] + files_validate_examples, CPPDEFINES=['ARM_COMPUTE_CL'], LIBS = test_env["LIBS"] + ["OpenCL"]) ]
- Depends(cl_examples, opencl)
+ cl_examples += [ test_env.Program(example, [ test_env.Object(source=file, target=example) ] + files_validate_examples, LIBS = test_env["LIBS"]) ]
arm_compute_validate_examples += cl_examples
if test_env['opencl'] and test_env['neon']:
if env['os'] == 'android':
Import('arm_compute_graph_a')
- Import("arm_compute_graph2_a")
- graph_dependency = [ arm_compute_graph_a, arm_compute_graph2_a]
+ graph_dependency = [ arm_compute_graph_a]
else:
Import('arm_compute_graph_so')
- Import("arm_compute_graph2_so")
- graph_dependency = [ arm_compute_graph_so, arm_compute_graph2_so]
+ graph_dependency = [ arm_compute_graph_so]
graph_utils = test_env.Object(source="../utils/GraphUtils.cpp", target="GraphUtils")
for file in Glob("validate_examples/graph_*.cpp"):
example = "validate_" + os.path.basename(os.path.splitext(str(file))[0])
if env['os'] == 'android':
- prog = test_env.Program(example, [ test_env.Object(source=file, target=example), graph_utils]+ files_validate_examples, LIBS = test_env["LIBS"] + ["OpenCL"], LINKFLAGS=test_env["LINKFLAGS"]+['-Wl,--whole-archive',graph_dependency,'-Wl,--no-whole-archive'])
- Depends(prog, [graph_dependency, opencl])
+ prog = test_env.Program(example, [ test_env.Object(source=file, target=example), graph_utils]+ files_validate_examples, LIBS = test_env["LIBS"], LINKFLAGS=test_env["LINKFLAGS"]+['-Wl,--whole-archive',graph_dependency,'-Wl,--no-whole-archive'])
+ Depends(prog, graph_dependency)
arm_compute_validate_examples += [ prog ]
else:
#-Wl,--allow-shlib-undefined: Ignore dependencies of dependencies
- prog = test_env.Program(example, [ test_env.Object(source=file, target=example), graph_utils]+ files_validate_examples, LIBS = test_env["LIBS"] + ["arm_compute_graph", "arm_compute_graph2"], LINKFLAGS=test_env["LINKFLAGS"]+['-Wl,--allow-shlib-undefined'] )
+ prog = test_env.Program(example, [ test_env.Object(source=file, target=example), graph_utils]+ files_validate_examples, LIBS = test_env["LIBS"] + ["arm_compute_graph"], LINKFLAGS=test_env["LINKFLAGS"]+['-Wl,--allow-shlib-undefined'] )
Depends(prog, graph_dependency)
arm_compute_validate_examples += [ prog ]
Depends(arm_compute_validate_examples, arm_compute_test_framework)
@@ -227,31 +197,28 @@ if test_env['benchmark_examples']:
files += Glob("../examples/neoncl_*.cpp")
for file in files:
example = "benchmark_" + os.path.basename(os.path.splitext(str(file))[0])
- cl_examples += [ test_env.Program(example, [ test_env.Object(source=file, target=example) ] + files_benchmark_examples, CPPDEFINES=['ARM_COMPUTE_CL'], LIBS = test_env["LIBS"] + ["OpenCL"]) ]
- Depends(cl_examples, opencl)
+ cl_examples += [ test_env.Program(example, [ test_env.Object(source=file, target=example) ] + files_benchmark_examples, LIBS = test_env["LIBS"]) ]
arm_compute_benchmark_examples += cl_examples
- if test_env['opencl'] and test_env['neon']:
- if env['os'] == 'android':
- Import('arm_compute_graph_a')
- Import("arm_compute_graph2_a")
- graph_dependency = [arm_compute_graph_a, arm_compute_graph2_a]
- else:
- Import('arm_compute_graph_so')
- Import('arm_compute_graph2_so')
- graph_dependency = [arm_compute_graph_so, arm_compute_graph2_so]
-
- graph_utils = test_env.Object(source="../utils/GraphUtils.cpp", target="GraphUtils")
- for file in Glob("../examples/graph_*.cpp"):
- example = "benchmark_" + os.path.basename(os.path.splitext(str(file))[0])
- if env['os'] == 'android':
- prog = test_env.Program(example, [ test_env.Object(source=file, target=example), graph_utils]+ files_benchmark_examples, LIBS = test_env["LIBS"] + ["OpenCL"], LINKFLAGS=test_env["LINKFLAGS"]+['-Wl,--whole-archive',graph_dependency,'-Wl,--no-whole-archive'])
- Depends(prog, [graph_dependency, opencl])
- arm_compute_benchmark_examples += [ prog ]
- else:
- #-Wl,--allow-shlib-undefined: Ignore dependencies of dependencies
- prog = test_env.Program(example, [ test_env.Object(source=file, target=example), graph_utils]+ files_benchmark_examples, LIBS = test_env["LIBS"] + ["arm_compute_graph", "arm_compute_graph2"], LINKFLAGS=test_env["LINKFLAGS"]+['-Wl,--allow-shlib-undefined'] )
- Depends(prog, graph_dependency)
- arm_compute_benchmark_examples += [ prog ]
+
+ # Graph examples
+ if env['os'] == 'android':
+ Import('arm_compute_graph_a')
+ graph_dependency = [arm_compute_graph_a]
+ else:
+ Import('arm_compute_graph_so')
+ graph_dependency = [arm_compute_graph_so]
+ graph_utils = test_env.Object(source="../utils/GraphUtils.cpp", target="GraphUtils")
+ for file in Glob("../examples/graph_*.cpp"):
+ example = "benchmark_" + os.path.basename(os.path.splitext(str(file))[0])
+ if env['os'] == 'android':
+ prog = test_env.Program(example, [ test_env.Object(source=file, target=example), graph_utils]+ files_benchmark_examples, LIBS = test_env["LIBS"], LINKFLAGS=test_env["LINKFLAGS"]+['-Wl,--whole-archive',graph_dependency,'-Wl,--no-whole-archive'])
+ Depends(prog, [graph_dependency])
+ arm_compute_benchmark_examples += [ prog ]
+ else:
+ #-Wl,--allow-shlib-undefined: Ignore dependencies of dependencies
+ prog = test_env.Program(example, [ test_env.Object(source=file, target=example), graph_utils]+ files_benchmark_examples, LIBS = test_env["LIBS"] + ["arm_compute_graph"], LINKFLAGS=test_env["LINKFLAGS"]+['-Wl,--allow-shlib-undefined'] )
+ Depends(prog, graph_dependency)
+ arm_compute_benchmark_examples += [ prog ]
Depends(arm_compute_benchmark_examples, arm_compute_test_framework)
Depends(arm_compute_benchmark_examples, arm_compute_lib)
Default(arm_compute_benchmark_examples)
diff --git a/utils/GraphTypePrinter.h b/utils/GraphTypePrinter.h
deleted file mode 100644
index 4ff1019cce..0000000000
--- a/utils/GraphTypePrinter.h
+++ /dev/null
@@ -1,88 +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_TEST_GRAPH_TYPE_PRINTER_H__
-#define __ARM_COMPUTE_TEST_GRAPH_TYPE_PRINTER_H__
-
-#include "arm_compute/graph/Types.h"
-
-#include <ostream>
-#include <sstream>
-#include <string>
-
-namespace arm_compute
-{
-namespace graph
-{
-/** Formatted output of the @ref ConvolutionMethodHint type. */
-inline ::std::ostream &operator<<(::std::ostream &os, const ConvolutionMethodHint &conv_method)
-{
- switch(conv_method)
- {
- case ConvolutionMethodHint::DIRECT:
- os << "DIRECT";
- break;
- case ConvolutionMethodHint::GEMM:
- os << "GEMM";
- break;
- default:
- ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
- }
-
- return os;
-}
-
-inline std::string to_string(const ConvolutionMethodHint &conv_method)
-{
- std::stringstream str;
- str << conv_method;
- return str.str();
-}
-
-/** Formatted output of the @ref TargetHint type. */
-inline ::std::ostream &operator<<(::std::ostream &os, const TargetHint &target_hint)
-{
- switch(target_hint)
- {
- case TargetHint::NEON:
- os << "NEON";
- break;
- case TargetHint::OPENCL:
- os << "OPENCL";
- break;
- default:
- ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
- }
-
- return os;
-}
-
-inline std::string to_string(const TargetHint &target_hint)
-{
- std::stringstream str;
- str << target_hint;
- return str.str();
-}
-} // namespace graph
-} // namespace arm_compute
-#endif /* __ARM_COMPUTE_TEST_GRAPH_TYPE_PRINTER_H__ */
diff --git a/utils/GraphUtils.cpp b/utils/GraphUtils.cpp
index 448343a977..7912fd6b7d 100644
--- a/utils/GraphUtils.cpp
+++ b/utils/GraphUtils.cpp
@@ -27,11 +27,6 @@
#include "arm_compute/runtime/SubTensor.h"
#include "utils/Utils.h"
-#ifdef ARM_COMPUTE_CL
-#include "arm_compute/core/CL/OpenCL.h"
-#include "arm_compute/runtime/CL/CLTensor.h"
-#endif /* ARM_COMPUTE_CL */
-
#include <iomanip>
using namespace arm_compute::graph_utils;
diff --git a/utils/GraphUtils.h b/utils/GraphUtils.h
index e70a1a275f..11f1e0590a 100644
--- a/utils/GraphUtils.h
+++ b/utils/GraphUtils.h
@@ -29,10 +29,6 @@
#include "arm_compute/graph/ITensorAccessor.h"
#include "arm_compute/graph/Types.h"
-#include "arm_compute/core/CL/OpenCL.h"
-
-#include "arm_compute/graph2/Types.h"
-
#include <array>
#include <random>
#include <string>
@@ -276,26 +272,6 @@ inline std::unique_ptr<graph::ITensorAccessor> get_input_accessor(const std::str
}
}
-/** Utility function to return the TargetHint
- *
- * @param[in] target Integer value which expresses the selected target. Must be 0 for NEON, 1 for OpenCL or 2 for OpenCL with Tuner
- *
- * @return the TargetHint
- */
-inline graph::TargetHint set_target_hint(int target)
-{
- ARM_COMPUTE_ERROR_ON_MSG(target > 2, "Invalid target. Target must be 0 (NEON), 1 (OpenCL) or 2 (OpenCL with Tuner)");
- if((target == 1 || target == 2) && graph::Graph::opencl_is_available())
- {
- // If type of target is OpenCL, check if OpenCL is available and initialize the scheduler
- return graph::TargetHint::OPENCL;
- }
- else
- {
- return graph::TargetHint::NEON;
- }
-}
-
/** Generates appropriate output accessor according to the specified labels_path
*
* @note If labels_path is empty will generate a DummyAccessor else will generate a TopNPredictionsAccessor
@@ -324,21 +300,20 @@ inline std::unique_ptr<graph::ITensorAccessor> get_output_accessor(const std::st
*
* @return the TargetHint
*/
-inline graph2::Target set_target_hint2(int target)
+inline graph::Target set_target_hint(int target)
{
ARM_COMPUTE_ERROR_ON_MSG(target > 3, "Invalid target. Target must be 0 (NEON), 1 (OpenCL), 2 (OpenCL + Tuner), 3 (GLES)");
- if((target == 1 || target == 2) && arm_compute::opencl_is_available())
+ if((target == 1 || target == 2))
{
- // If type of target is OpenCL, check if OpenCL is available and initialize the scheduler
- return graph2::Target::CL;
+ return graph::Target::CL;
}
else if(target == 3)
{
- return graph2::Target::GC;
+ return graph::Target::GC;
}
else
{
- return graph2::Target::NEON;
+ return graph::Target::NEON;
}
}
} // namespace graph_utils