From 2a07e184f7b359d13aa6cacfdc6431f9b191ef0c Mon Sep 17 00:00:00 2001 From: Anthony Barbier Date: Fri, 4 Aug 2017 18:20:27 +0100 Subject: COMPMID-363 Add Graph library support Change-Id: Ie841419bf65d0e06bdfe0bdd2d8d4e0bb3631e54 Reviewed-on: http://mpd-gerrit.cambridge.arm.com/87931 Reviewed-by: Pablo Tello Tested-by: Kaizen --- SConscript | 19 + arm_compute/graph/CL/CLMap.h | 66 +++ arm_compute/graph/CL/CLUnmap.h | 63 +++ arm_compute/graph/Graph.h | 132 +++++ arm_compute/graph/INode.h | 78 +++ arm_compute/graph/ITensorAccessor.h | 49 ++ arm_compute/graph/Nodes.h | 33 ++ arm_compute/graph/Tensor.h | 127 +++++ arm_compute/graph/Types.h | 54 ++ arm_compute/graph/nodes/ActivationLayer.h | 54 ++ arm_compute/graph/nodes/ConvolutionLayer.h | 71 +++ arm_compute/graph/nodes/FullyConnectedLayer.h | 63 +++ arm_compute/graph/nodes/PoolingLayer.h | 54 ++ arm_compute/graph/nodes/SoftmaxLayer.h | 46 ++ examples/SConscript | 14 + examples/graph_lenet.cpp | 143 +++++ scripts/clang_tidy_rules.py | 3 + src/graph/CL/CLMap.cpp | 42 ++ src/graph/CL/CLUnmap.cpp | 42 ++ src/graph/Graph.cpp | 255 +++++++++ src/graph/INode.cpp | 47 ++ src/graph/Tensor.cpp | 151 +++++ src/graph/nodes/ActivationLayer.cpp | 106 ++++ src/graph/nodes/ConvolutionLayer.cpp | 117 ++++ src/graph/nodes/FullyConnectedLayer.cpp | 130 +++++ src/graph/nodes/PoolingLayer.cpp | 104 ++++ src/graph/nodes/SoftmaxLayer.cpp | 97 ++++ tests/AssetsLibrary.cpp | 2 +- tests/TypePrinter.h | 609 -------------------- tests/benchmark/CL/ActivationLayer.cpp | 2 +- tests/benchmark/CL/BatchNormalizationLayer.cpp | 2 +- tests/benchmark/CL/ConvolutionLayer.cpp | 2 +- tests/benchmark/CL/DepthwiseConvolution.cpp | 2 +- .../CL/DepthwiseSeparableConvolutionLayer.cpp | 2 +- tests/benchmark/CL/DirectConvolutionLayer.cpp | 2 +- tests/benchmark/CL/Floor.cpp | 2 +- tests/benchmark/CL/FullyConnectedLayer.cpp | 2 +- tests/benchmark/CL/GEMM.cpp | 2 +- tests/benchmark/CL/NormalizationLayer.cpp | 2 +- tests/benchmark/CL/PoolingLayer.cpp | 2 +- tests/benchmark/CL/ROIPoolingLayer.cpp | 2 +- tests/benchmark/CL/SYSTEM/AlexNet.cpp | 2 +- tests/benchmark/CL/SYSTEM/LeNet5.cpp | 2 +- tests/benchmark/NEON/ActivationLayer.cpp | 2 +- tests/benchmark/NEON/BatchNormalizationLayer.cpp | 2 +- tests/benchmark/NEON/ConvolutionLayer.cpp | 2 +- tests/benchmark/NEON/DirectConvolutionLayer.cpp | 2 +- tests/benchmark/NEON/Floor.cpp | 2 +- tests/benchmark/NEON/FullyConnectedLayer.cpp | 2 +- tests/benchmark/NEON/GEMM.cpp | 2 +- tests/benchmark/NEON/NormalizationLayer.cpp | 2 +- tests/benchmark/NEON/PoolingLayer.cpp | 2 +- tests/benchmark/NEON/ROIPoolingLayer.cpp | 2 +- tests/benchmark/NEON/SYSTEM/AlexNet.cpp | 2 +- tests/benchmark/NEON/SYSTEM/LeNet5.cpp | 2 +- tests/datasets/BatchNormalizationLayerDataset.h | 2 +- tests/datasets/BorderModeDataset.h | 7 + tests/datasets/ConvolutionLayerDataset.h | 2 +- tests/datasets/DepthwiseConvolutionDataset.h | 2 +- .../DepthwiseSeparableConvolutionLayerDataset.h | 2 +- tests/datasets/DirectConvolutionLayerDataset.h | 2 +- tests/datasets/FullyConnectedLayerDataset.h | 2 +- tests/datasets/GEMMDataset.h | 2 +- tests/datasets/LargeConvolutionLayerDataset.h | 2 +- tests/datasets/LargeGEMMDataset.h | 2 +- tests/datasets/MatrixMultiplyGEMMDataset.h | 2 +- tests/datasets/MatrixPatternDataset.h | 7 + .../MobileNetDepthwiseConvolutionDataset.h | 2 +- ...eNetDepthwiseSeparableConvolutionLayerDataset.h | 2 +- tests/datasets/PoolingLayerDataset.h | 2 +- tests/datasets/ROIPoolingLayerDataset.h | 2 +- .../RandomBatchNormalizationLayerDataset.h | 2 +- tests/datasets/ReductionOperationDataset.h | 2 +- tests/datasets/ReshapeLayerDataset.h | 2 +- tests/datasets/SmallConvolutionLayerDataset.h | 2 +- tests/datasets/SmallGEMMDataset.h | 2 +- .../alexnet/AlexNetActivationLayerDataset.h | 2 +- .../alexnet/AlexNetConvolutionLayerDataset.h | 2 +- .../alexnet/AlexNetFullyConnectedLayerDataset.h | 2 +- .../alexnet/AlexNetNormalizationLayerDataset.h | 2 +- .../alexnet/AlexNetPoolingLayerDataset.h | 2 +- .../GoogLeNetInceptionV1ActivationLayerDataset.h | 2 +- .../GoogLeNetInceptionV1ConvolutionLayerDataset.h | 2 +- ...oogLeNetInceptionV1FullyConnectedLayerDataset.h | 2 +- .../inceptionv1/GoogLeNetInceptionV1GEMMDataset.h | 2 +- ...GoogLeNetInceptionV1NormalizationLayerDataset.h | 2 +- .../GoogLeNetInceptionV1PoolingLayerDataset.h | 2 +- .../GoogLeNetInceptionV4ActivationLayerDataset.h | 2 +- ...eNetInceptionV4BatchNormalizationLayerDataset.h | 2 +- .../GoogLeNetInceptionV4ConvolutionLayerDataset.h | 2 +- ...oogLeNetInceptionV4FullyConnectedLayerDataset.h | 2 +- .../GoogLeNetInceptionV4PoolingLayerDataset.h | 2 +- .../lenet5/LeNet5ActivationLayerDataset.h | 2 +- .../lenet5/LeNet5ConvolutionLayerDataset.h | 2 +- .../lenet5/LeNet5FullyConnectedLayerDataset.h | 2 +- .../lenet5/LeNet5PoolingLayerDataset.h | 2 +- .../squeezenet/SqueezeNetActivationLayerDataset.h | 2 +- .../squeezenet/SqueezeNetConvolutionLayerDataset.h | 2 +- .../squeezenet/SqueezeNetPoolingLayerDataset.h | 2 +- .../vgg/vgg16/VGG16ActivationLayerDataset.h | 2 +- .../vgg/vgg16/VGG16ConvolutionLayerDataset.h | 2 +- .../vgg/vgg16/VGG16FullyConnectedLayerDataset.h | 2 +- .../vgg/vgg16/VGG16PoolingLayerDataset.h | 2 +- .../yolo/v2/YOLOV2ActivationLayerDataset.h | 2 +- .../yolo/v2/YOLOV2BatchNormalizationLayerDataset.h | 2 +- .../yolo/v2/YOLOV2ConvolutionLayerDataset.h | 2 +- .../yolo/v2/YOLOV2PoolingLayerDataset.h | 2 +- tests/validation/Validation.h | 2 +- tests/validation_old/AssetsLibrary.cpp | 2 +- tests/validation_old/CL/FillBorder.cpp | 2 +- .../CL/FixedPoint/FixedPoint_QS8.cpp | 2 +- tests/validation_old/CL/Gaussian3x3.cpp | 2 +- tests/validation_old/CL/Gaussian5x5.cpp | 2 +- tests/validation_old/CL/HarrisCorners.cpp | 2 +- tests/validation_old/CL/IntegralImage.cpp | 2 +- tests/validation_old/CL/MinMaxLocation.cpp | 2 +- .../validation_old/CL/PixelWiseMultiplication.cpp | 2 +- tests/validation_old/CL/ROIPoolingLayer.cpp | 2 +- tests/validation_old/CL/Sobel3x3.cpp | 2 +- tests/validation_old/CL/Sobel5x5.cpp | 2 +- tests/validation_old/CL/Threshold.cpp | 2 +- tests/validation_old/CL/WarpPerspective.cpp | 2 +- tests/validation_old/NEON/AbsoluteDifference.cpp | 2 +- tests/validation_old/NEON/Accumulate.cpp | 2 +- tests/validation_old/NEON/AccumulateSquared.cpp | 2 +- tests/validation_old/NEON/AccumulateWeighted.cpp | 2 +- tests/validation_old/NEON/FillBorder.cpp | 2 +- tests/validation_old/NEON/Fixedpoint/Exp_QS16.cpp | 2 +- tests/validation_old/NEON/Fixedpoint/Exp_QS8.cpp | 2 +- .../NEON/Fixedpoint/Invsqrt_QS16.cpp | 2 +- .../validation_old/NEON/Fixedpoint/Invsqrt_QS8.cpp | 2 +- tests/validation_old/NEON/Fixedpoint/Log_QS16.cpp | 2 +- tests/validation_old/NEON/Fixedpoint/Log_QS8.cpp | 2 +- .../NEON/Fixedpoint/Reciprocal_QS16.cpp | 2 +- .../NEON/Fixedpoint/Reciprocal_QS8.cpp | 2 +- tests/validation_old/NEON/Gaussian3x3.cpp | 2 +- tests/validation_old/NEON/Gaussian5x5.cpp | 2 +- tests/validation_old/NEON/HarrisCorners.cpp | 2 +- tests/validation_old/NEON/IntegralImage.cpp | 2 +- tests/validation_old/NEON/MinMaxLocation.cpp | 2 +- .../NEON/PixelWiseMultiplication.cpp | 2 +- tests/validation_old/NEON/ROIPoolingLayer.cpp | 2 +- tests/validation_old/NEON/Sobel3x3.cpp | 2 +- tests/validation_old/NEON/Sobel5x5.cpp | 2 +- tests/validation_old/NEON/Threshold.cpp | 2 +- tests/validation_old/NEON/WarpPerspective.cpp | 2 +- tests/validation_old/ProgramOptions.cpp | 2 +- tests/validation_old/ReferenceCPP.cpp | 2 +- tests/validation_old/UNIT/FixedPoint.cpp | 2 +- tests/validation_old/UNIT/TensorInfo.cpp | 2 +- tests/validation_old/UNIT/TensorShape.cpp | 2 +- tests/validation_old/UNIT/Utils.cpp | 2 +- tests/validation_old/Validation.cpp | 2 +- .../dataset/ActivationLayerDataset.h | 2 +- .../dataset/BatchNormalizationLayerDataset.h | 2 +- .../dataset/ConvolutionLayerDataset.h | 2 +- .../dataset/FullyConnectedLayerDataset.h | 2 +- tests/validation_old/dataset/GEMMDataset.h | 2 +- .../dataset/NormalizationLayerDataset.h | 2 +- tests/validation_old/dataset/PoolingLayerDataset.h | 2 +- tests/validation_old/dataset/ThresholdDataset.h | 2 +- utils/GraphUtils.cpp | 165 ++++++ utils/GraphUtils.h | 97 ++++ utils/TypePrinter.h | 619 +++++++++++++++++++++ utils/Utils.h | 51 ++ 165 files changed, 3237 insertions(+), 740 deletions(-) create mode 100644 arm_compute/graph/CL/CLMap.h create mode 100644 arm_compute/graph/CL/CLUnmap.h create mode 100644 arm_compute/graph/Graph.h create mode 100644 arm_compute/graph/INode.h create mode 100644 arm_compute/graph/ITensorAccessor.h create mode 100644 arm_compute/graph/Nodes.h create mode 100644 arm_compute/graph/Tensor.h create mode 100644 arm_compute/graph/Types.h create mode 100644 arm_compute/graph/nodes/ActivationLayer.h create mode 100644 arm_compute/graph/nodes/ConvolutionLayer.h create mode 100644 arm_compute/graph/nodes/FullyConnectedLayer.h create mode 100644 arm_compute/graph/nodes/PoolingLayer.h create mode 100644 arm_compute/graph/nodes/SoftmaxLayer.h create mode 100644 examples/graph_lenet.cpp create mode 100644 src/graph/CL/CLMap.cpp create mode 100644 src/graph/CL/CLUnmap.cpp create mode 100644 src/graph/Graph.cpp create mode 100644 src/graph/INode.cpp create mode 100644 src/graph/Tensor.cpp create mode 100644 src/graph/nodes/ActivationLayer.cpp create mode 100644 src/graph/nodes/ConvolutionLayer.cpp create mode 100644 src/graph/nodes/FullyConnectedLayer.cpp create mode 100644 src/graph/nodes/PoolingLayer.cpp create mode 100644 src/graph/nodes/SoftmaxLayer.cpp delete mode 100644 tests/TypePrinter.h create mode 100644 utils/GraphUtils.cpp create mode 100644 utils/GraphUtils.h create mode 100644 utils/TypePrinter.h diff --git a/SConscript b/SConscript index d9ee169b2d..00c366e890 100644 --- a/SConscript +++ b/SConscript @@ -192,6 +192,25 @@ if env['os'] != 'bare_metal' and not env['standalone']: arm_compute_so = build_library('arm_compute', shared_core_objects + shared_runtime_objects, static=False) Export('arm_compute_so') +if env['neon'] and env['opencl']: + graph_files = Glob('src/graph/*.cpp') + graph_files += Glob('src/graph/nodes/*.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_core_objects + static_runtime_objects + static_graph_objects, static=True) + Export('arm_compute_graph_a') + + arm_compute_graph_so = build_library('arm_compute_graph', shared_core_objects + shared_runtime_objects + shared_graph_objects, static=False) + 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/arm_compute/graph/CL/CLMap.h b/arm_compute/graph/CL/CLMap.h new file mode 100644 index 0000000000..a205ebcad1 --- /dev/null +++ b/arm_compute/graph/CL/CLMap.h @@ -0,0 +1,66 @@ +/* + * 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 CLTensor; + +namespace graph +{ +class Tensor; +/** 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(Tensor *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::CLTensor *_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 new file mode 100644 index 0000000000..a72706353b --- /dev/null +++ b/arm_compute/graph/CL/CLUnmap.h @@ -0,0 +1,63 @@ +/* + * 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 CLTensor; + +namespace graph +{ +class Tensor; +/** OpenCL un-map function */ +class CLUnmap : public arm_compute::IFunction +{ +public: + /** Constructor + * + * @param[in] tensor Tensor to un-map + */ + CLUnmap(Tensor *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::CLTensor *_tensor; /**< Tensor */ +}; +} // namespace graph +} // namespace arm_compute +#endif /* __ARM_COMPUTE_GRAPH_CLUNMAP_H__ */ diff --git a/arm_compute/graph/Graph.h b/arm_compute/graph/Graph.h new file mode 100644 index 0000000000..3c263c2bdd --- /dev/null +++ b/arm_compute/graph/Graph.h @@ -0,0 +1,132 @@ +/* + * 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_GRAPH_H__ +#define __ARM_COMPUTE_GRAPH_GRAPH_H__ + +#include "arm_compute/graph/INode.h" +#include "arm_compute/graph/Tensor.h" +#include "arm_compute/graph/Types.h" +#include "support/ToolchainSupport.h" + +#include + +namespace arm_compute +{ +class IFunction; + +namespace graph +{ +/** Graph class */ +class Graph final +{ +public: + /** Constructor */ + Graph(); + /** Destructor */ + ~Graph(); + /** Prevent instances from being copy constructed */ + 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; + /** Executes the graph */ + void run(); + /** Adds a node to the graph + * + * @param[in] node Node to add + */ + void add_node(std::unique_ptr node); + /** Adds a tensor to the graph + * + * @param[in] tensor Tensor to add + */ + void add_tensor(std::unique_ptr tensor); + /** Sets an execution hint to the graph + * + * @note Hint is propagated to the following node and as per name + * its just a hint/preference to be considered by the graph executor + * + * @param[in] hint execution hint + */ + void set_hint(Hint hint); + /** Manually sets the output of the current node + * + * @param[in] tmp Output info to set + */ + void set_temp(TensorInfo &&tmp); + + /** Sets whether to enable information print out + * + * @param[in] is_enabled Set to true if need info printed out + */ + void set_info_enablement(bool is_enabled); + +private: + class Private; + std::unique_ptr _pimpl; /**< Internal implementation class */ +}; + +/** 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 provide an execution hint to the graph + * + * @param[in, out] graph Graph to provide the hint to + * @param[in] hint Execution hint to be considered + * + * @return Updated graph + */ +Graph &operator<<(Graph &graph, Hint 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 +Graph &operator<<(Graph &graph, Node node) +{ + graph.add_node(arm_compute::support::cpp14::make_unique(std::move(node))); + return graph; +} +} // namespace graph +} // namespace arm_compute +#endif /* __ARM_COMPUTE_GRAPH_GRAPH_H__ */ diff --git a/arm_compute/graph/INode.h b/arm_compute/graph/INode.h new file mode 100644 index 0000000000..13b5d05f87 --- /dev/null +++ b/arm_compute/graph/INode.h @@ -0,0 +1,78 @@ +/* + * 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_INODE_H__ +#define __ARM_COMPUTE_GRAPH_INODE_H__ + +#include "arm_compute/graph/Types.h" +#include "arm_compute/runtime/IFunction.h" + +#include + +namespace arm_compute +{ +namespace graph +{ +/** Node interface */ +class INode +{ +public: + /** Virtual Destructor */ + virtual ~INode() = default; + /** Interface to be implemented that instantiates the node + * + * @param[in] hint Hint to where the node should be executed + * @param[in] input Input tensor of the node + * @param[in] output Output tensor of the node + */ + virtual std::unique_ptr instantiate_node(Hint hint, ITensor *input, ITensor *output) = 0; + /** Override the existing hint + * + * @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] hint Hint to be considered + * + * @return The updated hint + */ + Hint override_hint(Hint hint) const; + + virtual void print_info() = 0; + +protected: + /** Interface to be implement that override the hint + * + * @param[in] hint Hint to be considered + * + * @return The updated hint + */ + virtual Hint node_override_hint(Hint hint) const; + +protected: + Hint _hint{ Hint::DONT_CARE }; + ITensor *_input{ nullptr }; + ITensor *_output{ nullptr }; +}; +} // namespace graph +} // namespace arm_compute +#endif /* __ARM_COMPUTE_GRAPH_INODE_H__ */ diff --git a/arm_compute/graph/ITensorAccessor.h b/arm_compute/graph/ITensorAccessor.h new file mode 100644 index 0000000000..d6a254ab73 --- /dev/null +++ b/arm_compute/graph/ITensorAccessor.h @@ -0,0 +1,49 @@ +/* + * 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_ITENSORACCESSOR_H__ +#define __ARM_COMPUTE_GRAPH_ITENSORACCESSOR_H__ + +#include "arm_compute/graph/Types.h" + +namespace arm_compute +{ +namespace graph +{ +/** Tensor accessor interface */ +class ITensorAccessor +{ +public: + /** Default virtual destructor */ + virtual ~ITensorAccessor() = default; + /** Interface to be implemented to access a given tensor + * + * @param[in] tensor Tensor to be accessed + * + * @return True if access is successful else false + */ + virtual bool access_tensor(ITensor &tensor) = 0; +}; +} // namespace graph +} // namespace arm_compute +#endif /* __ARM_COMPUTE_GRAPH_ITENSORACCESSOR_H__ */ diff --git a/arm_compute/graph/Nodes.h b/arm_compute/graph/Nodes.h new file mode 100644 index 0000000000..5e995ac8d1 --- /dev/null +++ b/arm_compute/graph/Nodes.h @@ -0,0 +1,33 @@ +/* + * 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_NODES_H__ +#define __ARM_COMPUTE_GRAPH_NODES_H__ + +#include "arm_compute/graph/nodes/ActivationLayer.h" +#include "arm_compute/graph/nodes/ConvolutionLayer.h" +#include "arm_compute/graph/nodes/FullyConnectedLayer.h" +#include "arm_compute/graph/nodes/PoolingLayer.h" +#include "arm_compute/graph/nodes/SoftmaxLayer.h" + +#endif /* __ARM_COMPUTE_GRAPH_NODES_H__ */ diff --git a/arm_compute/graph/Tensor.h b/arm_compute/graph/Tensor.h new file mode 100644 index 0000000000..0e823ffad0 --- /dev/null +++ b/arm_compute/graph/Tensor.h @@ -0,0 +1,127 @@ +/* + * 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_TENSOR_H__ +#define __ARM_COMPUTE_GRAPH_TENSOR_H__ + +#include "arm_compute/graph/ITensorAccessor.h" +#include "arm_compute/graph/Types.h" +#include "support/ToolchainSupport.h" + +#include + +namespace arm_compute +{ +namespace graph +{ +/** Tensor class */ +class Tensor +{ +public: + /** Constructor + * + * @param[in] info Tensor info to use + */ + Tensor(TensorInfo &&info); + /** Constructor + * + * @param[in] accessor Tensor accessor + */ + template + Tensor(std::unique_ptr accessor) + : _target(Hint::DONT_CARE), _info(), _accessor(std::move(accessor)), _tensor(nullptr) + { + } + /** Constructor + * + * @param[in] accessor Tensor accessor + */ + template + Tensor(AccessorType &&accessor) + : _target(Hint::DONT_CARE), _info(), _accessor(arm_compute::support::cpp14::make_unique(std::forward(accessor))), _tensor(nullptr) + { + } + /** Constructor + * + * @param[in] info Tensor info to use + * @param[in] accessor Tensor accessor + */ + template + Tensor(TensorInfo &&info, AccessorType &&accessor) + : _target(Hint::DONT_CARE), _info(info), _accessor(arm_compute::support::cpp14::make_unique(std::forward(accessor))), _tensor(nullptr) + { + } + /** Default Destructor */ + ~Tensor() = default; + /** Move Constructor + * + * @param[in] src Tensor to move + */ + Tensor(Tensor &&src) noexcept; + + /** Sets the given TensorInfo to the tensor + * + * @param[in] info TensorInfo to set + */ + void set_info(TensorInfo &&info); + /** Calls accessor on tensor + * + * @return True if succeeds else false + */ + bool call_accessor(); + /** Sets target of the tensor + * + * @param[in] target Target where the tensor should be pinned in + * + * @return + */ + ITensor *set_target(Hint target); + /** Returns tensor's TensorInfo + * + * @return TensorInfo of the tensor + */ + const TensorInfo &info() const; + /** Returns a pointer to the internal tensor + * + * @return Tensor + */ + ITensor *tensor(); + /** Allocates and fills the tensor if needed */ + void allocate_and_fill_if_needed(); + /** Allocates the tensor */ + void allocate(); + /** Return the target that this tensor is pinned on + * + * @return Target of the tensor + */ + Hint target() const; + +private: + Hint _target; /**< Target that this tensor is pinned on */ + TensorInfo _info; /**< Tensor metadata */ + std::unique_ptr _accessor; /**< Tensor Accessor */ + std::unique_ptr _tensor; /**< Tensor */ +}; +} // namespace graph +} // namespace arm_compute +#endif /* __ARM_COMPUTE_GRAPH_TENSOR_H__ */ diff --git a/arm_compute/graph/Types.h b/arm_compute/graph/Types.h new file mode 100644 index 0000000000..0b9596d589 --- /dev/null +++ b/arm_compute/graph/Types.h @@ -0,0 +1,54 @@ +/* + * 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_TYPES_H__ +#define __ARM_COMPUTE_GRAPH_TYPES_H__ + +#include "arm_compute/core/ITensor.h" +#include "arm_compute/core/TensorInfo.h" + +namespace arm_compute +{ +namespace graph +{ +using arm_compute::ActivationLayerInfo; +using arm_compute::ITensor; +using arm_compute::TensorInfo; +using arm_compute::DataType; +using arm_compute::TensorShape; +using arm_compute::PadStrideInfo; +using arm_compute::WeightsInfo; +using arm_compute::PoolingLayerInfo; +using arm_compute::PoolingType; + +/**< Execution hint to the graph executor */ +enum class Hint +{ + DONT_CARE, /**< Run node in any device */ + OPENCL, /**< Run node on an OpenCL capable device (GPU) */ + NEON /**< Run node on a NEON capable device */ +}; + +} // namespace graph +} // namespace arm_compute +#endif /*__ARM_COMPUTE_GRAPH_TYPES_H__*/ diff --git a/arm_compute/graph/nodes/ActivationLayer.h b/arm_compute/graph/nodes/ActivationLayer.h new file mode 100644 index 0000000000..c23674e7b6 --- /dev/null +++ b/arm_compute/graph/nodes/ActivationLayer.h @@ -0,0 +1,54 @@ +/* + * 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/INode.h" +#include "arm_compute/graph/Tensor.h" +#include "arm_compute/graph/Types.h" + +namespace arm_compute +{ +namespace graph +{ +/** Activation Layer node */ +class ActivationLayer : public INode +{ +public: + /** Default Constructor + * + * @param[in] activation_info Activation layer info + */ + ActivationLayer(const ActivationLayerInfo activation_info); + + // Inherited methods overriden: + std::unique_ptr instantiate_node(Hint hint, ITensor *input, ITensor *output) override; + void print_info() 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/graph/nodes/ConvolutionLayer.h b/arm_compute/graph/nodes/ConvolutionLayer.h new file mode 100644 index 0000000000..c0e257bf6a --- /dev/null +++ b/arm_compute/graph/nodes/ConvolutionLayer.h @@ -0,0 +1,71 @@ +/* + * 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_CONVOLUTION_LAYER_H__ +#define __ARM_COMPUTE_GRAPH_CONVOLUTION_LAYER_H__ + +#include "arm_compute/graph/INode.h" +#include "arm_compute/graph/Tensor.h" +#include "arm_compute/graph/Types.h" + +namespace arm_compute +{ +namespace graph +{ +/** Convolution layer node */ +class ConvolutionLayer : 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] weights_info Weights information + */ + template + ConvolutionLayer(unsigned int conv_width, unsigned int conv_height, unsigned int ofm, AccessorTypeWeights &&weights, + AccessorTypeBiases &&biases, const PadStrideInfo &conv_info, const WeightsInfo &weights_info = WeightsInfo()) + : _conv_width(conv_width), _conv_height(conv_height), _ofm(ofm), _weights(std::move(weights)), _biases(std::move(biases)), _conv_info(conv_info), _weights_info(weights_info) + { + } + + // Inherited methods overriden: + std::unique_ptr instantiate_node(Hint hint, ITensor *input, ITensor *output) override; + void print_info() override; + +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 */ + const WeightsInfo &_weights_info; /**< Convolution layer weights information */ +}; +} // namespace graph +} // namespace arm_compute +#endif /* __ARM_COMPUTE_GRAPH_CONVOLUTION_LAYER_H__ */ diff --git a/arm_compute/graph/nodes/FullyConnectedLayer.h b/arm_compute/graph/nodes/FullyConnectedLayer.h new file mode 100644 index 0000000000..3e1fe23b11 --- /dev/null +++ b/arm_compute/graph/nodes/FullyConnectedLayer.h @@ -0,0 +1,63 @@ +/* + * 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/INode.h" +#include "arm_compute/graph/Tensor.h" +#include "arm_compute/graph/Types.h" + +namespace arm_compute +{ +namespace graph +{ +/** Fully connected layer node */ +class FullyConnectedLayer : 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 + 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 instantiate_node(Hint hint, ITensor *input, ITensor *output) override; + void print_info() 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/graph/nodes/PoolingLayer.h b/arm_compute/graph/nodes/PoolingLayer.h new file mode 100644 index 0000000000..14e2c6d264 --- /dev/null +++ b/arm_compute/graph/nodes/PoolingLayer.h @@ -0,0 +1,54 @@ +/* + * 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/INode.h" +#include "arm_compute/graph/Tensor.h" +#include "arm_compute/graph/Types.h" + +namespace arm_compute +{ +namespace graph +{ +/** Pooling layer node */ +class PoolingLayer : public INode +{ +public: + /** Default Constructor + * + * @param pool_info Pooling layer information + */ + PoolingLayer(const PoolingLayerInfo pool_info); + + // Inherited methods overriden: + std::unique_ptr instantiate_node(Hint hint, ITensor *input, ITensor *output) override; + void print_info() 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/graph/nodes/SoftmaxLayer.h b/arm_compute/graph/nodes/SoftmaxLayer.h new file mode 100644 index 0000000000..1779adae66 --- /dev/null +++ b/arm_compute/graph/nodes/SoftmaxLayer.h @@ -0,0 +1,46 @@ +/* + * 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/INode.h" +#include "arm_compute/graph/Tensor.h" +#include "arm_compute/graph/Types.h" + +namespace arm_compute +{ +namespace graph +{ +/** Softmax layer node */ +class SoftmaxLayer : public INode +{ +public: + // Inherited methods overriden: + std::unique_ptr instantiate_node(Hint hint, ITensor *input, ITensor *output) override; + void print_info() override; +}; + +} // namespace graph +} // namespace arm_compute +#endif /* __ARM_COMPUTE_GRAPH_SOFTMAX_LAYER_H__ */ diff --git a/examples/SConscript b/examples/SConscript index 2303109bf5..853a1bb514 100644 --- a/examples/SConscript +++ b/examples/SConscript @@ -52,6 +52,20 @@ if env['opencl'] and env['neon']: Depends(prog, [arm_compute_dependency, opencl]) alias = examples_env.Alias(example, prog) Default(alias) + Import('arm_compute_graph_a') + Import('arm_compute_graph_so') + if env['os'] == 'android': + arm_compute_graph_lib = arm_compute_graph_a + else: + arm_compute_graph_lib = "arm_compute_graph" + + 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 = examples_env.Program(example, ["{}.cpp".format(example), utils, graph_utils], CPPDEFINES=['ARM_COMPUTE_CL'], LIBS = [arm_compute_graph_lib, "OpenCL"]) + Depends(prog, [arm_compute_dependency, opencl]) + alias = examples_env.Alias(example, prog) + Default(alias) if env['opencl']: for file in Glob("./cl_*.cpp"): diff --git a/examples/graph_lenet.cpp b/examples/graph_lenet.cpp new file mode 100644 index 0000000000..9e6551973b --- /dev/null +++ b/examples/graph_lenet.cpp @@ -0,0 +1,143 @@ +/* + * 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_CL /* Needed by Utils.cpp to handle OpenCL exceptions properly */ +#error "This example needs to be built with -DARM_COMPUTE_CL" +#endif /* ARM_COMPUTE_CL */ + +#include "arm_compute/graph/Graph.h" +#include "arm_compute/graph/Nodes.h" +#include "arm_compute/runtime/CL/CLScheduler.h" +#include "arm_compute/runtime/Scheduler.h" +#include "support/ToolchainSupport.h" +#include "utils/GraphUtils.h" +#include "utils/Utils.h" + +#include +#include +#include + +using namespace arm_compute::graph; +using namespace arm_compute::graph_utils; + +/** Generates appropriate accessor according to the specified path + * + * @note If path is empty will generate a DummyAccessor else will generate a NumPyBinLoader + * + * @param path Path to the data files + * @param data_file Relative path to the data files from path + * + * @return An appropriate tensor accessor + */ +std::unique_ptr get_accessor(const std::string &path, const std::string &data_file) +{ + if(path.empty()) + { + return arm_compute::support::cpp14::make_unique(); + } + else + { + return arm_compute::support::cpp14::make_unique(path + data_file); + } +} + +/** Example demonstrating how to implement LeNet's network using the Compute Library's graph API + * + * @param[in] argc Number of arguments + * @param[in] argv Arguments ( [optional] Path to the weights folder, [optional] batches ) + */ +void main_graph_lenet(int argc, const char **argv) +{ + std::string data_path; /** Path to the trainable data */ + unsigned int batches = 4; /** Number of batches */ + + // Parse arguments + if(argc < 2) + { + // Print help + std::cout << "Usage: " << argv[0] << " [path_to_data] [batches]\n\n"; + std::cout << "No data folder provided: using random values\n\n"; + } + else if(argc == 2) + { + //Do something with argv[1] + data_path = argv[1]; + std::cout << "Usage: " << argv[0] << " [path_to_data] [batches]\n\n"; + std::cout << "No number of batches where specified, thus will use the default : " << batches << "\n\n"; + } + else + { + //Do something with argv[1] and argv[2] + data_path = argv[1]; + batches = std::strtol(argv[2], nullptr, 0); + } + + // Check if OpenCL is available and initialize the scheduler + if(arm_compute::opencl_is_available()) + { + arm_compute::CLScheduler::get().default_init(); + } + + Graph graph; + graph.set_info_enablement(true); + + //conv1 << pool1 << conv2 << pool2 << fc1 << act1 << fc2 << smx + graph << Hint::OPENCL + << Tensor(TensorInfo(TensorShape(28U, 28U, 1U, batches), 1, DataType::F32), DummyAccessor()) + << ConvolutionLayer( + 5U, 5U, 20U, + get_accessor(data_path, "/cnn_data/lenet_model/conv1_w.npy"), + get_accessor(data_path, "/cnn_data/lenet_model/conv1_b.npy"), + PadStrideInfo(1, 1, 0, 0)) + << PoolingLayer(PoolingLayerInfo(PoolingType::MAX, 2, PadStrideInfo(2, 2, 0, 0))) + << ConvolutionLayer( + 5U, 5U, 50U, + get_accessor(data_path, "/cnn_data/lenet_model/conv2_w.npy"), + get_accessor(data_path, "/cnn_data/lenet_model/conv2_b.npy"), + PadStrideInfo(1, 1, 0, 0)) + << PoolingLayer(PoolingLayerInfo(PoolingType::MAX, 2, PadStrideInfo(2, 2, 0, 0))) + << FullyConnectedLayer( + 500U, + get_accessor(data_path, "/cnn_data/lenet_model/ip1_w.npy"), + get_accessor(data_path, "/cnn_data/lenet_model/ip1_b.npy")) + << TensorInfo(TensorShape(500U, batches), 1, DataType::F32) + << ActivationLayer(ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU)) + << FullyConnectedLayer( + 10U, + get_accessor(data_path, "/cnn_data/lenet_model/ip2_w.npy"), + get_accessor(data_path, "/cnn_data/lenet_model/ip2_b.npy")) + << SoftmaxLayer() + << Tensor(DummyAccessor()); + + graph.run(); +} + +/** Main program for LeNet + * + * @param[in] argc Number of arguments + * @param[in] argv Arguments ( [optional] Path to the weights folder, [optional] batches ) + */ +int main(int argc, const char **argv) +{ + return arm_compute::utils::run_example(argc, argv, main_graph_lenet); +} diff --git a/scripts/clang_tidy_rules.py b/scripts/clang_tidy_rules.py index e4daceb071..c3faf8736c 100755 --- a/scripts/clang_tidy_rules.py +++ b/scripts/clang_tidy_rules.py @@ -49,6 +49,8 @@ def filter_clang_tidy_lines( lines ): ("omp.h" in line) or ("memory" in line and "cast from pointer to smaller type 'uintptr_t' (aka 'unsigned int') loses information" in line) or ("NEMath.inl" in line and "statement expression not allowed at file scope" in line) or + ("Utils.h" in line and "no member named 'unmap' in 'arm_compute::Tensor'" in line) or + ("Utils.h" in line and "no member named 'map' in 'arm_compute::Tensor'" in line) or "3rdparty" in line): print_context=False continue @@ -76,6 +78,7 @@ def filter_clang_tidy_lines( lines ): ("NEGEMMMatrixMultiplyKernel.cpp" in line and "do not use C-style cast to convert between unrelated types" in line) or ("NEPoolingLayerKernel.cpp" in line and "do not use C-style cast to convert between unrelated types" in line) or ("NESoftmaxLayerKernel.cpp" in line and "do not use C-style cast to convert between unrelated types" in line) or + ("GraphUtils.cpp" in line and "consider replacing 'unsigned long' with 'uint64'" in line) or ("parameter 'memory_manager' is unused" in line) or ("parameter 'memory_manager' is copied for each invocation but only used as a const reference" in line) or "3rdparty" in line): diff --git a/src/graph/CL/CLMap.cpp b/src/graph/CL/CLMap.cpp new file mode 100644 index 0000000000..4892b9609b --- /dev/null +++ b/src/graph/CL/CLMap.cpp @@ -0,0 +1,42 @@ +/* + * 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/Helpers.h" +#include "arm_compute/core/Validate.h" +#include "arm_compute/graph/Tensor.h" +#include "arm_compute/runtime/CL/CLTensor.h" + +using namespace arm_compute::graph; + +CLMap::CLMap(Tensor *tensor, bool blocking) + : _tensor(dynamic_cast(tensor->tensor())), _blocking(blocking) +{ + ARM_COMPUTE_ERROR_ON_NULLPTR(_tensor); +} + +void CLMap::run() +{ + _tensor->map(_blocking); +} diff --git a/src/graph/CL/CLUnmap.cpp b/src/graph/CL/CLUnmap.cpp new file mode 100644 index 0000000000..ec7d8650d6 --- /dev/null +++ b/src/graph/CL/CLUnmap.cpp @@ -0,0 +1,42 @@ +/* + * 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/Helpers.h" +#include "arm_compute/core/Validate.h" +#include "arm_compute/graph/Tensor.h" +#include "arm_compute/runtime/CL/CLTensor.h" + +using namespace arm_compute::graph; + +CLUnmap::CLUnmap(Tensor *tensor) + : _tensor(dynamic_cast(tensor->tensor())) +{ + ARM_COMPUTE_ERROR_ON_NULLPTR(_tensor); +} + +void CLUnmap::run() +{ + _tensor->unmap(); +} diff --git a/src/graph/Graph.cpp b/src/graph/Graph.cpp new file mode 100644 index 0000000000..525506f316 --- /dev/null +++ b/src/graph/Graph.cpp @@ -0,0 +1,255 @@ +/* + * 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/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/Tensor.h" +#include "arm_compute/runtime/CL/CLTensor.h" +#include "arm_compute/runtime/Tensor.h" + +using namespace arm_compute::graph; + +struct Stage +{ + Tensor *_input; + Tensor *_output; + std::unique_ptr _function; +}; + +struct Graph::Private +{ +public: + /** Finalizes the current node's configuration + * + * @param _next_hint Device execution hint + */ + void configure(Hint _next_hint); + + /** Sets whether to enable information print out + * + * @param[in] is_enabled Set to true if need info printed out + */ + void set_info_enablement(bool is_enabled); + + std::vector _pipeline{}; + std::vector> _tensors{}; + std::vector> _nodes{}; + Hint _current_hint{ Hint::DONT_CARE }; + Hint _next_hint{ Hint::DONT_CARE }; + std::unique_ptr _graph_input{ nullptr }; + std::unique_ptr _graph_output{ nullptr }; + std::unique_ptr _current_node{ nullptr }; + Tensor *_current_output{ nullptr }; + bool _info_enabled{ false }; + +private: + Tensor *_current_input{ nullptr }; + Hint _previous_hint{ Hint::DONT_CARE }; +}; + +Graph::~Graph() //NOLINT +{ + //Can't use =default because the destructor must be defined after Graph::Private's definition +} + +Graph::Graph() + : _pimpl{ new Private() } +{ +} + +void Graph::run() +{ + while(true) + { + if(!_pimpl->_graph_input->call_accessor()) + { + return; + } + + for(auto &stage : _pimpl->_pipeline) + { + stage._function->run(); + } + + if(!_pimpl->_graph_output->call_accessor()) + { + return; + } + } +} + +//Finalize current node's configuration +void Graph::Private::configure(Hint _next_hint) +{ + ARM_COMPUTE_ERROR_ON(_current_node == nullptr); + ARM_COMPUTE_ERROR_ON(_graph_input == nullptr); + + // Is it the first node of the graph ? + if(_current_input == nullptr) + { + _graph_input->set_target(_current_hint); + _current_input = _graph_input.get(); + _previous_hint = _current_hint; // For the first node just assume the previous node was of the same type as this one + } + + //Automatic output configuration ? + if(_current_output == nullptr) + { + _tensors.push_back(arm_compute::support::cpp14::make_unique(TensorInfo())); + _current_output = _tensors.back().get(); + } + + // If either the writer or reader node needs OpenCL then use OpenCL memory: + if((_next_hint == Hint::OPENCL || _current_hint == Hint::OPENCL)) + { + _current_output->set_target(Hint::OPENCL); + } + else + { + _current_output->set_target(Hint::NEON); + } + + // Map input if needed + std::unique_ptr func = _current_node->instantiate_node(_current_hint, _current_input->tensor(), _current_output->tensor()); + _current_input->allocate(); + + if(_current_input->target() == Hint::OPENCL) + { + if(_previous_hint == Hint::NEON) + { + ARM_COMPUTE_ERROR_ON(_current_hint == Hint::NEON); + _pipeline.push_back({ _current_input, _current_input, arm_compute::support::cpp14::make_unique(_current_input) }); + } + if(_current_hint == Hint::NEON) + { + ARM_COMPUTE_ERROR_ON(_previous_hint == Hint::NEON); + _pipeline.push_back({ _current_input, _current_input, arm_compute::support::cpp14::make_unique(_current_input, true) }); + } + } + + _pipeline.push_back({ _current_input, _current_output, std::move(func) }); + + _current_input = _current_output; + _current_output = nullptr; + _previous_hint = _current_hint; + _current_hint = _next_hint; +} + +void Graph::Private::set_info_enablement(bool is_enabled) +{ + _info_enabled = is_enabled; +} + +void Graph::add_node(std::unique_ptr node) +{ + 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: + + Hint _next_hint = node->override_hint(_pimpl->_next_hint); + ARM_COMPUTE_ERROR_ON(_next_hint == Hint::DONT_CARE); + if(_pimpl->_current_node) + { + //Finalize the previous Node: + _pimpl->configure(_pimpl->_next_hint); + + if(_pimpl->_info_enabled) + { + _pimpl->_current_node->print_info(); + } + } + else + { + // If that's the first node then use the same Hint before and after the node. + _pimpl->_current_hint = _next_hint; + } + if(_pimpl->_current_node) + { + _pimpl->_nodes.push_back(std::move(_pimpl->_current_node)); + } + _pimpl->_current_node = std::move(node); +} +void Graph::set_hint(Hint hint) +{ + _pimpl->_next_hint = hint; +} + +void Graph::set_info_enablement(bool is_enabled) +{ + _pimpl->set_info_enablement(is_enabled); +} + +//Add a tensor with an Accessor (i.e either the input or output of the graph) +void Graph::add_tensor(std::unique_ptr tensor) +{ + // 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_hint); // Ignore _next_hint as this is the last node, and just use the same hint as before this node. + _pimpl->_graph_output->allocate(); + } +} + +void Graph::set_temp(TensorInfo &&tmp) +{ + 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"); + + _pimpl->_tensors.push_back(arm_compute::support::cpp14::make_unique(std::move(tmp))); + _pimpl->_current_output = _pimpl->_tensors.back().get(); +} + +Graph &arm_compute::graph::operator<<(Graph &graph, TensorInfo &&info) +{ + graph.set_temp(std::move(info)); + return graph; +} + +Graph &arm_compute::graph::operator<<(Graph &graph, Tensor &&tensor) +{ + graph.add_tensor(arm_compute::support::cpp14::make_unique(std::move(tensor))); + return graph; +} + +Graph &arm_compute::graph::operator<<(Graph &graph, Hint hint) +{ + graph.set_hint(hint); + return graph; +} diff --git a/src/graph/INode.cpp b/src/graph/INode.cpp new file mode 100644 index 0000000000..6b25022d15 --- /dev/null +++ b/src/graph/INode.cpp @@ -0,0 +1,47 @@ +/* + * 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/INode.h" + +#include "arm_compute/core/CL/OpenCL.h" +#include "arm_compute/core/Validate.h" + +#include + +using namespace arm_compute::graph; + +Hint INode::override_hint(Hint hint) const +{ + if(hint == Hint::OPENCL && !opencl_is_available()) + { + hint = Hint::DONT_CARE; + } + hint = node_override_hint(hint); + ARM_COMPUTE_ERROR_ON(hint == Hint::OPENCL && !opencl_is_available()); + return hint; +} +Hint INode::node_override_hint(Hint hint) const +{ + return hint == Hint::DONT_CARE ? Hint::NEON : hint; +} diff --git a/src/graph/Tensor.cpp b/src/graph/Tensor.cpp new file mode 100644 index 0000000000..c534ae0296 --- /dev/null +++ b/src/graph/Tensor.cpp @@ -0,0 +1,151 @@ +/* + * 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/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 +{ +template +std::unique_ptr initialise_tensor(TensorInfo &info) +{ + auto tensor = arm_compute::support::cpp14::make_unique(); + tensor->allocator()->init(info); + return std::move(tensor); +} + +template +void tensor_allocate(ITensor &tensor) +{ + auto itensor = dynamic_cast(&tensor); + ARM_COMPUTE_ERROR_ON_NULLPTR(itensor); + itensor->allocator()->allocate(); +} +} // namespace + +Tensor::Tensor(TensorInfo &&info) + : _target(Hint::DONT_CARE), _info(info), _accessor(nullptr), _tensor(nullptr) +{ +} + +Tensor::Tensor(Tensor &&src) noexcept + : _target(src._target), + _info(std::move(src._info)), + _accessor(std::move(src._accessor)), + _tensor(std::move(src._tensor)) +{ +} + +void Tensor::set_info(TensorInfo &&info) +{ + _info = info; +} + +bool Tensor::call_accessor() +{ + ARM_COMPUTE_ERROR_ON_NULLPTR(_accessor.get()); + auto cl_tensor = dynamic_cast(_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; +} + +ITensor *Tensor::tensor() +{ + return _tensor.get(); +} + +const TensorInfo &Tensor::info() const +{ + return _info; +} + +ITensor *Tensor::set_target(Hint target) +{ + if(_tensor != nullptr) + { + ARM_COMPUTE_ERROR_ON(target != _target); + } + else + { + switch(target) + { + case Hint::OPENCL: + _tensor = initialise_tensor(_info); + break; + case Hint::NEON: + _tensor = initialise_tensor(_info); + break; + default: + ARM_COMPUTE_ERROR("Invalid Hint"); + } + _target = target; + } + return _tensor.get(); +} + +void Tensor::allocate() +{ + ARM_COMPUTE_ERROR_ON_NULLPTR(_tensor.get()); + switch(_target) + { + case Hint::OPENCL: + tensor_allocate(*_tensor); + break; + case Hint::NEON: + tensor_allocate(*_tensor); + break; + default: + ARM_COMPUTE_ERROR("Invalid Hint"); + } +} + +void Tensor::allocate_and_fill_if_needed() +{ + allocate(); + if(_accessor != nullptr) + { + call_accessor(); + } +} + +Hint Tensor::target() const +{ + return _target; +} diff --git a/src/graph/nodes/ActivationLayer.cpp b/src/graph/nodes/ActivationLayer.cpp new file mode 100644 index 0000000000..b71e22c601 --- /dev/null +++ b/src/graph/nodes/ActivationLayer.cpp @@ -0,0 +1,106 @@ +/* + * 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/ActivationLayer.h" + +#include "arm_compute/runtime/CL/CLTensor.h" +#include "arm_compute/runtime/CL/functions/CLActivationLayer.h" +#include "arm_compute/runtime/NEON/functions/NEActivationLayer.h" +#include "arm_compute/runtime/Tensor.h" +#include "support/ToolchainSupport.h" +#include "utils/TypePrinter.h" + +using namespace arm_compute::graph; + +namespace +{ +template +std::unique_ptr instantiate_function(ITensor *input, ITensor *output, const ActivationLayerInfo &activation_info) +{ + auto activation = arm_compute::support::cpp14::make_unique(); + activation->configure( + dynamic_cast(input), + dynamic_cast(output), + activation_info); + + return std::move(activation); +} + +template +std::unique_ptr instantiate(ITensor *input, ITensor *output, const ActivationLayerInfo &activation_info); + +template <> +std::unique_ptr instantiate(ITensor *input, ITensor *output, const ActivationLayerInfo &activation_info) +{ + return instantiate_function(input, output, activation_info); +} + +template <> +std::unique_ptr instantiate(ITensor *input, ITensor *output, const ActivationLayerInfo &activation_info) +{ + return instantiate_function(input, output, activation_info); +} +} // namespace + +ActivationLayer::ActivationLayer(const ActivationLayerInfo activation_info) + : _activation_info(activation_info) +{ +} + +std::unique_ptr ActivationLayer::instantiate_node(Hint hint, ITensor *input, ITensor *output) +{ + std::unique_ptr func; + _hint = hint; + _input = input; + _output = output; + + if(_hint == Hint::OPENCL) + { + func = instantiate(input, output, _activation_info); + } + else + { + func = instantiate(input, output, _activation_info); + } + return func; +} + +void ActivationLayer::print_info() +{ + if(_hint == Hint::OPENCL) + { + std::cout << "Instantiating CLActivationLayer"; + } + else + { + std::cout << "Instantiating NEActivationLayer"; + } + + std::cout << " Data Type: " << _input->info()->data_type() + << " Input shape: " << _input->info()->tensor_shape() + << " Output shape: " << _output->info()->tensor_shape() + << " Activation function: " << _activation_info.activation() + << " a: " << _activation_info.a() + << " b: " << _activation_info.b() + << std::endl; +} diff --git a/src/graph/nodes/ConvolutionLayer.cpp b/src/graph/nodes/ConvolutionLayer.cpp new file mode 100644 index 0000000000..b80bf93eff --- /dev/null +++ b/src/graph/nodes/ConvolutionLayer.cpp @@ -0,0 +1,117 @@ +/* + * 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/ConvolutionLayer.h" + +#include "arm_compute/runtime/CL/functions/CLConvolutionLayer.h" +#include "arm_compute/runtime/NEON/functions/NEConvolutionLayer.h" +#include "support/ToolchainSupport.h" +#include "utils/TypePrinter.h" + +using namespace arm_compute::graph; + +namespace +{ +template +std::unique_ptr instantiate_function(ITensor *input, Tensor &weights, Tensor &biases, ITensor *output, const PadStrideInfo &conv_info, const WeightsInfo &weights_info) +{ + bool weights_are_loaded = weights.tensor() != nullptr; + bool biases_are_loaded = biases.tensor() != nullptr; + + auto conv = arm_compute::support::cpp14::make_unique(); + conv->configure( + dynamic_cast(input), + dynamic_cast(weights.set_target(hint)), + dynamic_cast(biases.set_target(hint)), + dynamic_cast(output), + conv_info, weights_info); + if(!weights_are_loaded) + { + weights.allocate_and_fill_if_needed(); + } + if(!biases_are_loaded) + { + biases.allocate_and_fill_if_needed(); + } + + return std::move(conv); +} + +template +std::unique_ptr instantiate(ITensor *input, Tensor &weights, Tensor &biases, ITensor *output, const PadStrideInfo &conv_info, const WeightsInfo &weights_info); + +template <> +std::unique_ptr instantiate(ITensor *input, Tensor &weights, Tensor &biases, ITensor *output, const PadStrideInfo &conv_info, const WeightsInfo &weights_info) +{ + return instantiate_function(input, weights, biases, output, conv_info, weights_info); +} + +template <> +std::unique_ptr instantiate(ITensor *input, Tensor &weights, Tensor &biases, ITensor *output, const PadStrideInfo &conv_info, const WeightsInfo &weights_info) +{ + return instantiate_function(input, weights, biases, output, conv_info, weights_info); +} +} // namespace + +std::unique_ptr ConvolutionLayer::instantiate_node(Hint hint, ITensor *input, ITensor *output) +{ + if(_weights.tensor() == nullptr) + { + _weights.set_info(TensorInfo(TensorShape(_conv_width, _conv_height, input->info()->dimension(2), _ofm), input->info()->num_channels(), input->info()->data_type(), + input->info()->fixed_point_position())); + } + if(_biases.tensor() == nullptr) + { + _biases.set_info(TensorInfo(TensorShape(_ofm), input->info()->num_channels(), input->info()->data_type(), input->info()->fixed_point_position())); + } + + std::unique_ptr func; + _hint = hint; + _input = input; + _output = output; + + if(_hint == Hint::OPENCL) + { + func = instantiate(input, _weights, _biases, output, _conv_info, _weights_info); + } + else + { + func = instantiate(input, _weights, _biases, output, _conv_info, _weights_info); + } + + return func; +} + +void ConvolutionLayer::print_info() +{ + if(_hint == Hint::OPENCL) + { + std::cout << "Instantiating CLConvolutionLayer"; + } + else + { + std::cout << "Instantiating NEConvolutionLayer"; + } + std::cout << " Type: " << _input->info()->data_type() << " Input Shape: " << _input->info()->tensor_shape() << " Weights shape: " << _weights.info().tensor_shape() << " Biases Shape: " << + _biases.info().tensor_shape() << " Output Shape: " << _output->info()->tensor_shape() << " PadStrideInfo: " << _conv_info << "WeightsInfo: " << _weights_info << std::endl; +} diff --git a/src/graph/nodes/FullyConnectedLayer.cpp b/src/graph/nodes/FullyConnectedLayer.cpp new file mode 100644 index 0000000000..8d244cb515 --- /dev/null +++ b/src/graph/nodes/FullyConnectedLayer.cpp @@ -0,0 +1,130 @@ +/* + * 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/FullyConnectedLayer.h" + +#include "arm_compute/core/Helpers.h" +#include "arm_compute/runtime/CL/functions/CLFullyConnectedLayer.h" +#include "arm_compute/runtime/NEON/functions/NEFullyConnectedLayer.h" +#include "support/ToolchainSupport.h" +#include "utils/TypePrinter.h" + +using namespace arm_compute::graph; + +namespace +{ +template +std::unique_ptr instantiate_function(ITensor *input, Tensor &weights, Tensor &biases, ITensor *output) +{ + bool weights_are_loaded = weights.tensor() != nullptr; + bool biases_are_loaded = biases.tensor() != nullptr; + + auto conv = arm_compute::support::cpp14::make_unique(); + conv->configure( + dynamic_cast(input), + dynamic_cast(weights.set_target(hint)), + dynamic_cast(biases.set_target(hint)), + dynamic_cast(output)); + if(!weights_are_loaded) + { + weights.allocate_and_fill_if_needed(); + } + if(!biases_are_loaded) + { + biases.allocate_and_fill_if_needed(); + } + + return std::move(conv); +} + +template +std::unique_ptr instantiate(ITensor *input, Tensor &weights, Tensor &biases, ITensor *output); + +template <> +std::unique_ptr instantiate(ITensor *input, Tensor &weights, Tensor &biases, ITensor *output) +{ + return instantiate_function(input, weights, biases, output); +} + +template <> +std::unique_ptr instantiate(ITensor *input, Tensor &weights, Tensor &biases, ITensor *output) +{ + return instantiate_function(input, weights, biases, output); +} +} // namespace + +std::unique_ptr FullyConnectedLayer::instantiate_node(Hint hint, ITensor *input, ITensor *output) +{ + if(_weights.tensor() == nullptr) + { + unsigned int num_weights = 1; + unsigned int num_dimensions = input->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 *= input->info()->dimension(i); + } + _weights.set_info(TensorInfo(TensorShape(num_weights, _num_neurons), input->info()->num_channels(), input->info()->data_type(), input->info()->fixed_point_position())); + } + if(_biases.tensor() == nullptr) + { + _biases.set_info(TensorInfo(TensorShape(_num_neurons), input->info()->num_channels(), input->info()->data_type(), input->info()->fixed_point_position())); + } + + arm_compute::auto_init_if_empty(*output->info(), TensorShape(_num_neurons, input->info()->dimension(1)), input->info()->num_channels(), input->info()->data_type(), + input->info()->fixed_point_position()); + + std::unique_ptr func; + _hint = hint; + _input = input; + _output = output; + + if(_hint == Hint::OPENCL) + { + func = instantiate(input, _weights, _biases, output); + } + else + { + func = instantiate(input, _weights, _biases, output); + } + + return func; +} + +void FullyConnectedLayer::print_info() +{ + if(_hint == Hint::OPENCL) + { + std::cout << "Instantiating CLFullyConnectedLayer"; + } + else + { + std::cout << "Instantiating NEFullyConnectedLayer"; + } + std::cout << " Type: " << _input->info()->data_type() << " Input Shape: " << _input->info()->tensor_shape() << " Weights shape: " << _weights.info().tensor_shape() << " Biases Shape: " << + _biases.info().tensor_shape() << " Output Shape: " << _output->info()->tensor_shape() << std::endl; +} diff --git a/src/graph/nodes/PoolingLayer.cpp b/src/graph/nodes/PoolingLayer.cpp new file mode 100644 index 0000000000..f29332f65b --- /dev/null +++ b/src/graph/nodes/PoolingLayer.cpp @@ -0,0 +1,104 @@ +/* + * 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/runtime/CL/CLTensor.h" +#include "arm_compute/runtime/CL/functions/CLPoolingLayer.h" +#include "arm_compute/runtime/NEON/functions/NEPoolingLayer.h" +#include "arm_compute/runtime/Tensor.h" +#include "support/ToolchainSupport.h" +#include "utils/TypePrinter.h" + +using namespace arm_compute::graph; + +namespace +{ +template +std::unique_ptr instantiate_function(ITensor *input, ITensor *output, const PoolingLayerInfo &pool_info) +{ + auto pool = arm_compute::support::cpp14::make_unique(); + pool->configure( + dynamic_cast(input), + dynamic_cast(output), + pool_info); + + return std::move(pool); +} + +template +std::unique_ptr instantiate(ITensor *input, ITensor *output, const PoolingLayerInfo &pool_info); + +template <> +std::unique_ptr instantiate(ITensor *input, ITensor *output, const PoolingLayerInfo &pool_info) +{ + return instantiate_function(input, output, pool_info); +} + +template <> +std::unique_ptr instantiate(ITensor *input, ITensor *output, const PoolingLayerInfo &pool_info) +{ + return instantiate_function(input, output, pool_info); +} +} // namespace + +PoolingLayer::PoolingLayer(const PoolingLayerInfo pool_info) + : _pool_info(pool_info) +{ +} + +std::unique_ptr PoolingLayer::instantiate_node(Hint hint, ITensor *input, ITensor *output) +{ + std::unique_ptr func; + _hint = hint; + _input = input; + _output = output; + + if(_hint == Hint::OPENCL) + { + func = instantiate(input, output, _pool_info); + } + else + { + func = instantiate(input, output, _pool_info); + } + + return func; +} + +void PoolingLayer::print_info() +{ + if(_hint == Hint::OPENCL) + { + std::cout << "Instantiating CLPoolingLayer"; + } + else + { + std::cout << "Instantiating NEPoolingLayer"; + } + + std::cout << " Data Type: " << _input->info()->data_type() + << " Input shape: " << _input->info()->tensor_shape() + << " Output shape: " << _output->info()->tensor_shape() + << " Pooling info: " << _pool_info << std::endl; +} diff --git a/src/graph/nodes/SoftmaxLayer.cpp b/src/graph/nodes/SoftmaxLayer.cpp new file mode 100644 index 0000000000..fee88970fc --- /dev/null +++ b/src/graph/nodes/SoftmaxLayer.cpp @@ -0,0 +1,97 @@ +/* + * 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/runtime/CL/CLTensor.h" +#include "arm_compute/runtime/CL/functions/CLSoftmaxLayer.h" +#include "arm_compute/runtime/NEON/functions/NESoftmaxLayer.h" +#include "arm_compute/runtime/Tensor.h" +#include "support/ToolchainSupport.h" +#include "utils/TypePrinter.h" + +using namespace arm_compute::graph; + +namespace +{ +template +std::unique_ptr instantiate_function(ITensor *input, ITensor *output) +{ + auto softmax = arm_compute::support::cpp14::make_unique(); + softmax->configure( + dynamic_cast(input), + dynamic_cast(output)); + + return std::move(softmax); +} + +template +std::unique_ptr instantiate(ITensor *input, ITensor *output); + +template <> +std::unique_ptr instantiate(ITensor *input, ITensor *output) +{ + return instantiate_function(input, output); +} + +template <> +std::unique_ptr instantiate(ITensor *input, ITensor *output) +{ + return instantiate_function(input, output); +} +} // namespace + +std::unique_ptr SoftmaxLayer::instantiate_node(Hint hint, ITensor *input, ITensor *output) +{ + std::unique_ptr func; + _hint = hint; + _input = input; + _output = output; + + if(_hint == Hint::OPENCL) + { + func = instantiate(input, output); + } + else + { + func = instantiate(input, output); + } + + return func; +} + +void SoftmaxLayer::print_info() +{ + if(_hint == Hint::OPENCL) + { + std::cout << "Instantiating CLSoftmaxLayer"; + } + else + { + std::cout << "Instantiating NESoftmaxLayer"; + } + std::cout << " Data Type: " << _input->info()->data_type() + << " Input shape: " << _input->info()->tensor_shape() + << " Output shape: " << _output->info()->tensor_shape() + << std::endl; +} diff --git a/tests/AssetsLibrary.cpp b/tests/AssetsLibrary.cpp index d7c881d9a8..529a2a2d95 100644 --- a/tests/AssetsLibrary.cpp +++ b/tests/AssetsLibrary.cpp @@ -23,8 +23,8 @@ */ #include "tests/AssetsLibrary.h" -#include "TypePrinter.h" #include "Utils.h" +#include "utils/TypePrinter.h" #include "arm_compute/core/ITensor.h" diff --git a/tests/TypePrinter.h b/tests/TypePrinter.h deleted file mode 100644 index d3d9f8f5ac..0000000000 --- a/tests/TypePrinter.h +++ /dev/null @@ -1,609 +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_TYPE_PRINTER_H__ -#define __ARM_COMPUTE_TEST_TYPE_PRINTER_H__ - -#include "arm_compute/core/Dimensions.h" -#include "arm_compute/core/Error.h" -#include "arm_compute/core/Types.h" - -#include -#include -#include - -namespace arm_compute -{ -/** Formatted output of the Dimensions type. */ -template -inline ::std::ostream &operator<<(::std::ostream &os, const Dimensions &dimensions) -{ - if(dimensions.num_dimensions() > 0) - { - os << dimensions[0]; - - for(unsigned int d = 1; d < dimensions.num_dimensions(); ++d) - { - os << "x" << dimensions[d]; - } - } - - return os; -} - -//FIXME: Check why this doesn't work and the TensorShape overload is needed -template -inline std::string to_string(const Dimensions &dimensions) -{ - std::stringstream str; - str << dimensions; - return str.str(); -} - -inline std::string to_string(const TensorShape &shape) -{ - std::stringstream str; - str << shape; - return str.str(); -} - -/** Formatted output of the Rectangle type. */ -inline ::std::ostream &operator<<(::std::ostream &os, const Rectangle &rect) -{ - os << rect.width << "x" << rect.height; - os << "+" << rect.x << "+" << rect.y; - - return os; -} - -/** Formatted output of the PadStridInfo type. */ -inline ::std::ostream &operator<<(::std::ostream &os, const PadStrideInfo &pad_stride_info) -{ - os << pad_stride_info.stride().first << "," << pad_stride_info.stride().second; - os << ";"; - os << pad_stride_info.pad().first << "," << pad_stride_info.pad().second; - - return os; -} - -inline std::string to_string(const PadStrideInfo &pad_stride_info) -{ - std::stringstream str; - str << pad_stride_info; - return str.str(); -} - -/** Formatted output of the ROIPoolingInfo type. */ -inline ::std::ostream &operator<<(::std::ostream &os, const ROIPoolingLayerInfo &pool_info) -{ - os << pool_info.pooled_width() << "x" << pool_info.pooled_height() << "~" << pool_info.spatial_scale(); - return os; -} - -/** Formatted output of the BorderMode type. */ -inline ::std::ostream &operator<<(::std::ostream &os, const BorderMode &mode) -{ - switch(mode) - { - case BorderMode::UNDEFINED: - os << "UNDEFINED"; - break; - case BorderMode::CONSTANT: - os << "CONSTANT"; - break; - case BorderMode::REPLICATE: - os << "REPLICATE"; - break; - default: - ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); - } - - return os; -} - -inline std::string to_string(const BorderMode &mode) -{ - std::stringstream str; - str << mode; - return str.str(); -} - -/** Formatted output of the NonLinearFilterFunction type. */ -inline ::std::ostream &operator<<(::std::ostream &os, const NonLinearFilterFunction &function) -{ - switch(function) - { - case NonLinearFilterFunction::MAX: - os << "MAX"; - break; - case NonLinearFilterFunction::MEDIAN: - os << "MEDIAN"; - break; - case NonLinearFilterFunction::MIN: - os << "MIN"; - break; - default: - ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); - } - - return os; -} - -inline std::string to_string(const NonLinearFilterFunction &function) -{ - std::stringstream str; - str << function; - return str.str(); -} - -/** Formatted output of the MatrixPattern type. */ -inline ::std::ostream &operator<<(::std::ostream &os, const MatrixPattern &pattern) -{ - switch(pattern) - { - case MatrixPattern::BOX: - os << "BOX"; - break; - case MatrixPattern::CROSS: - os << "CROSS"; - break; - case MatrixPattern::DISK: - os << "DISK"; - break; - case MatrixPattern::OTHER: - os << "OTHER"; - break; - default: - ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); - } - - return os; -} - -inline std::string to_string(const MatrixPattern &pattern) -{ - std::stringstream str; - str << pattern; - return str.str(); -} - -/** Formatted output of the InterpolationPolicy type. */ -inline ::std::ostream &operator<<(::std::ostream &os, const InterpolationPolicy &policy) -{ - switch(policy) - { - case InterpolationPolicy::NEAREST_NEIGHBOR: - os << "NEAREST_NEIGHBOR"; - break; - case InterpolationPolicy::BILINEAR: - os << "BILINEAR"; - break; - case InterpolationPolicy::AREA: - os << "AREA"; - break; - default: - ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); - } - - return os; -} - -inline std::string to_string(const InterpolationPolicy &policy) -{ - std::stringstream str; - str << policy; - return str.str(); -} - -/** Formatted output of the ConversionPolicy type. */ -inline ::std::ostream &operator<<(::std::ostream &os, const ConvertPolicy &policy) -{ - switch(policy) - { - case ConvertPolicy::WRAP: - os << "WRAP"; - break; - case ConvertPolicy::SATURATE: - os << "SATURATE"; - break; - default: - ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); - } - - return os; -} - -inline std::string to_string(const ConvertPolicy &policy) -{ - std::stringstream str; - str << policy; - return str.str(); -} - -/** Formatted output of the Reduction Operations. */ -inline ::std::ostream &operator<<(::std::ostream &os, const ReductionOperation &op) -{ - switch(op) - { - case ReductionOperation::SUM_SQUARE: - os << "SUM_SQUARE"; - break; - default: - ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); - } - - return os; -} - -inline std::string to_string(const ReductionOperation &op) -{ - std::stringstream str; - str << op; - return str.str(); -} - -/** Formatted output of the activation function type. */ -inline ::std::ostream &operator<<(::std::ostream &os, const ActivationLayerInfo::ActivationFunction &act_function) -{ - switch(act_function) - { - case ActivationLayerInfo::ActivationFunction::ABS: - os << "ABS"; - break; - case ActivationLayerInfo::ActivationFunction::LINEAR: - os << "LINEAR"; - break; - case ActivationLayerInfo::ActivationFunction::LOGISTIC: - os << "LOGISTIC"; - break; - case ActivationLayerInfo::ActivationFunction::RELU: - os << "RELU"; - break; - case ActivationLayerInfo::ActivationFunction::BOUNDED_RELU: - os << "BOUNDED_RELU"; - break; - case ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU: - os << "LU_BOUNDED_RELU"; - break; - case ActivationLayerInfo::ActivationFunction::LEAKY_RELU: - os << "LEAKY_RELU"; - break; - case ActivationLayerInfo::ActivationFunction::SOFT_RELU: - os << "SOFT_RELU"; - break; - case ActivationLayerInfo::ActivationFunction::SQRT: - os << "SQRT"; - break; - case ActivationLayerInfo::ActivationFunction::SQUARE: - os << "SQUARE"; - break; - case ActivationLayerInfo::ActivationFunction::TANH: - os << "TANH"; - break; - default: - ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); - } - - return os; -} - -inline std::string to_string(const ActivationLayerInfo::ActivationFunction &function) -{ - std::stringstream str; - str << function; - return str.str(); -} - -inline std::string to_string(const ActivationLayerInfo &info) -{ - std::stringstream str; - str << info.activation(); - return str.str(); -} - -/** Formatted output of the NormType type. */ -inline ::std::ostream &operator<<(::std::ostream &os, const NormType &norm_type) -{ - switch(norm_type) - { - case NormType::CROSS_MAP: - os << "CROSS_MAP"; - break; - case NormType::IN_MAP_1D: - os << "IN_MAP_1D"; - break; - case NormType::IN_MAP_2D: - os << "IN_MAP_2D"; - break; - default: - ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); - } - - return os; -} - -inline std::string to_string(const NormType &type) -{ - std::stringstream str; - str << type; - return str.str(); -} - -inline std::string to_string(const NormalizationLayerInfo &info) -{ - std::stringstream str; - str << info.type(); - return str.str(); -} - -/** Formatted output of the PoolingType type. */ -inline ::std::ostream &operator<<(::std::ostream &os, const PoolingType &pool_type) -{ - switch(pool_type) - { - case PoolingType::AVG: - os << "AVG"; - break; - case PoolingType::MAX: - os << "MAX"; - break; - case PoolingType::L2: - os << "L2"; - break; - default: - ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); - } - - return os; -} - -inline std::string to_string(const PoolingType &type) -{ - std::stringstream str; - str << type; - return str.str(); -} - -/** Formatted output of @ref PoolingLayerInfo. */ -inline ::std::ostream &operator<<(::std::ostream &os, const PoolingLayerInfo &info) -{ - os << info.pool_type() << ";" << info.pool_size() << ";" << info.pad_stride_info(); - - return os; -} - -inline std::string to_string(const PoolingLayerInfo &info) -{ - std::stringstream str; - str << info.pool_type(); - return str.str(); -} - -/** Formatted output of the RoundingPolicy type. */ -inline ::std::ostream &operator<<(::std::ostream &os, const RoundingPolicy &rounding_policy) -{ - switch(rounding_policy) - { - case RoundingPolicy::TO_ZERO: - os << "TO_ZERO"; - break; - case RoundingPolicy::TO_NEAREST_UP: - os << "TO_NEAREST_UP"; - break; - case RoundingPolicy::TO_NEAREST_EVEN: - os << "TO_NEAREST_EVEN"; - break; - default: - ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); - } - - return os; -} - -/** Formatted output of the DataType type. */ -inline ::std::ostream &operator<<(::std::ostream &os, const DataType &data_type) -{ - switch(data_type) - { - case DataType::UNKNOWN: - os << "UNKNOWN"; - break; - case DataType::U8: - os << "U8"; - break; - case DataType::QS8: - os << "QS8"; - break; - case DataType::S8: - os << "S8"; - break; - case DataType::U16: - os << "U16"; - break; - case DataType::S16: - os << "S16"; - break; - case DataType::QS16: - os << "QS16"; - break; - case DataType::U32: - os << "U32"; - break; - case DataType::S32: - os << "S32"; - break; - case DataType::U64: - os << "U64"; - break; - case DataType::S64: - os << "S64"; - break; - case DataType::F16: - os << "F16"; - break; - case DataType::F32: - os << "F32"; - break; - case DataType::F64: - os << "F64"; - break; - case DataType::SIZET: - os << "SIZET"; - break; - default: - ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); - } - - return os; -} - -inline std::string to_string(const DataType &data_type) -{ - std::stringstream str; - str << data_type; - return str.str(); -} - -/** Formatted output of the Format type. */ -inline ::std::ostream &operator<<(::std::ostream &os, const Format &format) -{ - switch(format) - { - case Format::UNKNOWN: - os << "UNKNOWN"; - break; - case Format::U8: - os << "U8"; - break; - case Format::S16: - os << "S16"; - break; - case Format::U16: - os << "U16"; - break; - case Format::S32: - os << "S32"; - break; - case Format::U32: - os << "U32"; - break; - case Format::F16: - os << "F16"; - break; - case Format::F32: - os << "F32"; - break; - case Format::UV88: - os << "UV88"; - break; - case Format::RGB888: - os << "RGB888"; - break; - case Format::RGBA8888: - os << "RGBA8888"; - break; - case Format::YUV444: - os << "YUV444"; - break; - case Format::YUYV422: - os << "YUYV422"; - break; - case Format::NV12: - os << "NV12"; - break; - case Format::NV21: - os << "NV21"; - break; - case Format::IYUV: - os << "IYUV"; - break; - case Format::UYVY422: - os << "UYVY422"; - break; - default: - ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); - } - - return os; -} - -/** Formatted output of the Channel type. */ -inline ::std::ostream &operator<<(::std::ostream &os, const Channel &channel) -{ - switch(channel) - { - case Channel::UNKNOWN: - os << "UNKNOWN"; - break; - case Channel::C0: - os << "C0"; - break; - case Channel::C1: - os << "C1"; - break; - case Channel::C2: - os << "C2"; - break; - case Channel::C3: - os << "C3"; - break; - case Channel::R: - os << "R"; - break; - case Channel::G: - os << "G"; - break; - case Channel::B: - os << "B"; - break; - case Channel::A: - os << "A"; - break; - case Channel::Y: - os << "Y"; - break; - case Channel::U: - os << "U"; - break; - case Channel::V: - os << "V"; - break; - default: - ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); - } - - return os; -} - -/** Formatted output of the BorderSize type. */ -inline ::std::ostream &operator<<(::std::ostream &os, const BorderSize &border) -{ - os << border.top << "," - << border.right << "," - << border.bottom << "," - << border.left; - - return os; -} -} // namespace arm_compute -#endif /* __ARM_COMPUTE_TEST_TYPE_PRINTER_H__ */ diff --git a/tests/benchmark/CL/ActivationLayer.cpp b/tests/benchmark/CL/ActivationLayer.cpp index 50a2004b07..e919c7820b 100644 --- a/tests/benchmark/CL/ActivationLayer.cpp +++ b/tests/benchmark/CL/ActivationLayer.cpp @@ -27,7 +27,6 @@ #include "arm_compute/runtime/CL/CLTensorAllocator.h" #include "arm_compute/runtime/CL/functions/CLActivationLayer.h" #include "tests/CL/CLAccessor.h" -#include "tests/TypePrinter.h" #include "tests/benchmark/fixtures/ActivationLayerFixture.h" #include "tests/datasets/system_tests/alexnet/AlexNetActivationLayerDataset.h" #include "tests/datasets/system_tests/googlenet/inceptionv1/GoogLeNetInceptionV1ActivationLayerDataset.h" @@ -38,6 +37,7 @@ #include "tests/datasets/system_tests/yolo/v2/YOLOV2ActivationLayerDataset.h" #include "tests/framework/Macros.h" #include "tests/framework/datasets/Datasets.h" +#include "utils/TypePrinter.h" namespace arm_compute { diff --git a/tests/benchmark/CL/BatchNormalizationLayer.cpp b/tests/benchmark/CL/BatchNormalizationLayer.cpp index b0e36d31af..af88278fef 100644 --- a/tests/benchmark/CL/BatchNormalizationLayer.cpp +++ b/tests/benchmark/CL/BatchNormalizationLayer.cpp @@ -27,12 +27,12 @@ #include "arm_compute/runtime/CL/CLTensorAllocator.h" #include "arm_compute/runtime/CL/functions/CLBatchNormalizationLayer.h" #include "tests/CL/CLAccessor.h" -#include "tests/TypePrinter.h" #include "tests/benchmark/fixtures/BatchNormalizationLayerFixture.h" #include "tests/datasets/system_tests/googlenet/inceptionv4/GoogLeNetInceptionV4BatchNormalizationLayerDataset.h" #include "tests/datasets/system_tests/yolo/v2/YOLOV2BatchNormalizationLayerDataset.h" #include "tests/framework/Macros.h" #include "tests/framework/datasets/Datasets.h" +#include "utils/TypePrinter.h" namespace arm_compute { diff --git a/tests/benchmark/CL/ConvolutionLayer.cpp b/tests/benchmark/CL/ConvolutionLayer.cpp index 620feafa83..4467765878 100644 --- a/tests/benchmark/CL/ConvolutionLayer.cpp +++ b/tests/benchmark/CL/ConvolutionLayer.cpp @@ -27,7 +27,6 @@ #include "arm_compute/runtime/CL/CLTensorAllocator.h" #include "arm_compute/runtime/CL/functions/CLConvolutionLayer.h" #include "tests/CL/CLAccessor.h" -#include "tests/TypePrinter.h" #include "tests/benchmark/fixtures/ConvolutionLayerFixture.h" #include "tests/datasets/system_tests/alexnet/AlexNetConvolutionLayerDataset.h" #include "tests/datasets/system_tests/googlenet/inceptionv1/GoogLeNetInceptionV1ConvolutionLayerDataset.h" @@ -38,6 +37,7 @@ #include "tests/datasets/system_tests/yolo/v2/YOLOV2ConvolutionLayerDataset.h" #include "tests/framework/Macros.h" #include "tests/framework/datasets/Datasets.h" +#include "utils/TypePrinter.h" namespace arm_compute { diff --git a/tests/benchmark/CL/DepthwiseConvolution.cpp b/tests/benchmark/CL/DepthwiseConvolution.cpp index a8c229fad8..40412da6f9 100644 --- a/tests/benchmark/CL/DepthwiseConvolution.cpp +++ b/tests/benchmark/CL/DepthwiseConvolution.cpp @@ -27,11 +27,11 @@ #include "arm_compute/runtime/CL/CLTensorAllocator.h" #include "arm_compute/runtime/CL/functions/CLDepthwiseConvolution.h" #include "tests/CL/CLAccessor.h" -#include "tests/TypePrinter.h" #include "tests/benchmark/fixtures/DepthwiseConvolutionFixture.h" #include "tests/datasets/MobileNetDepthwiseConvolutionDataset.h" #include "tests/framework/Macros.h" #include "tests/framework/datasets/Datasets.h" +#include "utils/TypePrinter.h" namespace arm_compute { diff --git a/tests/benchmark/CL/DepthwiseSeparableConvolutionLayer.cpp b/tests/benchmark/CL/DepthwiseSeparableConvolutionLayer.cpp index 0c4fbb18bd..7f5bb00583 100644 --- a/tests/benchmark/CL/DepthwiseSeparableConvolutionLayer.cpp +++ b/tests/benchmark/CL/DepthwiseSeparableConvolutionLayer.cpp @@ -27,11 +27,11 @@ #include "arm_compute/runtime/CL/CLTensorAllocator.h" #include "arm_compute/runtime/CL/functions/CLDepthwiseSeparableConvolutionLayer.h" #include "tests/CL/CLAccessor.h" -#include "tests/TypePrinter.h" #include "tests/benchmark/fixtures/DepthwiseSeparableConvolutionLayerFixture.h" #include "tests/datasets/MobileNetDepthwiseSeparableConvolutionLayerDataset.h" #include "tests/framework/Macros.h" #include "tests/framework/datasets/Datasets.h" +#include "utils/TypePrinter.h" namespace arm_compute { diff --git a/tests/benchmark/CL/DirectConvolutionLayer.cpp b/tests/benchmark/CL/DirectConvolutionLayer.cpp index 15bf8084ea..2430a4ee94 100644 --- a/tests/benchmark/CL/DirectConvolutionLayer.cpp +++ b/tests/benchmark/CL/DirectConvolutionLayer.cpp @@ -27,7 +27,6 @@ #include "arm_compute/runtime/CL/CLTensorAllocator.h" #include "arm_compute/runtime/CL/functions/CLDirectConvolutionLayer.h" #include "tests/CL/CLAccessor.h" -#include "tests/TypePrinter.h" #include "tests/benchmark/fixtures/ConvolutionLayerFixture.h" #include "tests/datasets/system_tests/alexnet/AlexNetConvolutionLayerDataset.h" #include "tests/datasets/system_tests/googlenet/inceptionv1/GoogLeNetInceptionV1ConvolutionLayerDataset.h" @@ -37,6 +36,7 @@ #include "tests/datasets/system_tests/yolo/v2/YOLOV2ConvolutionLayerDataset.h" #include "tests/framework/Macros.h" #include "tests/framework/datasets/Datasets.h" +#include "utils/TypePrinter.h" namespace arm_compute { diff --git a/tests/benchmark/CL/Floor.cpp b/tests/benchmark/CL/Floor.cpp index ce8fa487c1..b2ada0ebc5 100644 --- a/tests/benchmark/CL/Floor.cpp +++ b/tests/benchmark/CL/Floor.cpp @@ -27,11 +27,11 @@ #include "arm_compute/runtime/CL/CLTensorAllocator.h" #include "arm_compute/runtime/CL/functions/CLFloor.h" #include "tests/CL/CLAccessor.h" -#include "tests/TypePrinter.h" #include "tests/benchmark/fixtures/FloorFixture.h" #include "tests/datasets/ShapeDatasets.h" #include "tests/framework/Macros.h" #include "tests/framework/datasets/Datasets.h" +#include "utils/TypePrinter.h" namespace arm_compute { diff --git a/tests/benchmark/CL/FullyConnectedLayer.cpp b/tests/benchmark/CL/FullyConnectedLayer.cpp index d41424acce..e5f3217368 100644 --- a/tests/benchmark/CL/FullyConnectedLayer.cpp +++ b/tests/benchmark/CL/FullyConnectedLayer.cpp @@ -27,7 +27,6 @@ #include "arm_compute/runtime/CL/CLTensorAllocator.h" #include "arm_compute/runtime/CL/functions/CLFullyConnectedLayer.h" #include "tests/CL/CLAccessor.h" -#include "tests/TypePrinter.h" #include "tests/benchmark/fixtures/FullyConnectedLayerFixture.h" #include "tests/datasets/system_tests/alexnet/AlexNetFullyConnectedLayerDataset.h" #include "tests/datasets/system_tests/googlenet/inceptionv1/GoogLeNetInceptionV1FullyConnectedLayerDataset.h" @@ -36,6 +35,7 @@ #include "tests/datasets/system_tests/vgg/vgg16/VGG16FullyConnectedLayerDataset.h" #include "tests/framework/Macros.h" #include "tests/framework/datasets/Datasets.h" +#include "utils/TypePrinter.h" namespace arm_compute { diff --git a/tests/benchmark/CL/GEMM.cpp b/tests/benchmark/CL/GEMM.cpp index 3febef5613..ece20433b9 100644 --- a/tests/benchmark/CL/GEMM.cpp +++ b/tests/benchmark/CL/GEMM.cpp @@ -26,12 +26,12 @@ #include "arm_compute/runtime/CL/CLTensorAllocator.h" #include "arm_compute/runtime/CL/functions/CLGEMM.h" #include "tests/CL/CLAccessor.h" -#include "tests/TypePrinter.h" #include "tests/benchmark/fixtures/GEMMFixture.h" #include "tests/datasets/MatrixMultiplyGEMMDataset.h" #include "tests/datasets/system_tests/googlenet/inceptionv1/GoogLeNetInceptionV1GEMMDataset.h" #include "tests/framework/Macros.h" #include "tests/framework/datasets/Datasets.h" +#include "utils/TypePrinter.h" namespace arm_compute { diff --git a/tests/benchmark/CL/NormalizationLayer.cpp b/tests/benchmark/CL/NormalizationLayer.cpp index 2035ae301a..8dd5f62dd3 100644 --- a/tests/benchmark/CL/NormalizationLayer.cpp +++ b/tests/benchmark/CL/NormalizationLayer.cpp @@ -27,12 +27,12 @@ #include "arm_compute/runtime/CL/CLTensorAllocator.h" #include "arm_compute/runtime/CL/functions/CLNormalizationLayer.h" #include "tests/CL/CLAccessor.h" -#include "tests/TypePrinter.h" #include "tests/benchmark/fixtures/NormalizationLayerFixture.h" #include "tests/datasets/system_tests/alexnet/AlexNetNormalizationLayerDataset.h" #include "tests/datasets/system_tests/googlenet/inceptionv1/GoogLeNetInceptionV1NormalizationLayerDataset.h" #include "tests/framework/Macros.h" #include "tests/framework/datasets/Datasets.h" +#include "utils/TypePrinter.h" namespace arm_compute { diff --git a/tests/benchmark/CL/PoolingLayer.cpp b/tests/benchmark/CL/PoolingLayer.cpp index fcc37e9571..116639a1d0 100644 --- a/tests/benchmark/CL/PoolingLayer.cpp +++ b/tests/benchmark/CL/PoolingLayer.cpp @@ -27,7 +27,6 @@ #include "arm_compute/runtime/CL/CLTensorAllocator.h" #include "arm_compute/runtime/CL/functions/CLPoolingLayer.h" #include "tests/CL/CLAccessor.h" -#include "tests/TypePrinter.h" #include "tests/benchmark/fixtures/PoolingLayerFixture.h" #include "tests/datasets/system_tests/alexnet/AlexNetPoolingLayerDataset.h" #include "tests/datasets/system_tests/googlenet/inceptionv1/GoogLeNetInceptionV1PoolingLayerDataset.h" @@ -38,6 +37,7 @@ #include "tests/datasets/system_tests/yolo/v2/YOLOV2PoolingLayerDataset.h" #include "tests/framework/Macros.h" #include "tests/framework/datasets/Datasets.h" +#include "utils/TypePrinter.h" namespace arm_compute { diff --git a/tests/benchmark/CL/ROIPoolingLayer.cpp b/tests/benchmark/CL/ROIPoolingLayer.cpp index a10134fb04..4e78673287 100644 --- a/tests/benchmark/CL/ROIPoolingLayer.cpp +++ b/tests/benchmark/CL/ROIPoolingLayer.cpp @@ -29,11 +29,11 @@ #include "arm_compute/runtime/CL/functions/CLROIPoolingLayer.h" #include "tests/CL/CLAccessor.h" #include "tests/CL/CLArrayAccessor.h" -#include "tests/TypePrinter.h" #include "tests/benchmark/fixtures/ROIPoolingLayerFixture.h" #include "tests/datasets/ROIPoolingLayerDataset.h" #include "tests/framework/Macros.h" #include "tests/framework/datasets/Datasets.h" +#include "utils/TypePrinter.h" namespace arm_compute { diff --git a/tests/benchmark/CL/SYSTEM/AlexNet.cpp b/tests/benchmark/CL/SYSTEM/AlexNet.cpp index fcf8a52f9e..5f258412de 100644 --- a/tests/benchmark/CL/SYSTEM/AlexNet.cpp +++ b/tests/benchmark/CL/SYSTEM/AlexNet.cpp @@ -34,10 +34,10 @@ #include "arm_compute/runtime/CL/functions/CLPoolingLayer.h" #include "arm_compute/runtime/CL/functions/CLSoftmaxLayer.h" #include "tests/CL/CLAccessor.h" -#include "tests/TypePrinter.h" #include "tests/benchmark/fixtures/AlexNetFixture.h" #include "tests/framework/Macros.h" #include "tests/framework/datasets/Datasets.h" +#include "utils/TypePrinter.h" namespace arm_compute { diff --git a/tests/benchmark/CL/SYSTEM/LeNet5.cpp b/tests/benchmark/CL/SYSTEM/LeNet5.cpp index 35ebc7d8fb..21e5432947 100644 --- a/tests/benchmark/CL/SYSTEM/LeNet5.cpp +++ b/tests/benchmark/CL/SYSTEM/LeNet5.cpp @@ -31,10 +31,10 @@ #include "arm_compute/runtime/CL/functions/CLPoolingLayer.h" #include "arm_compute/runtime/CL/functions/CLSoftmaxLayer.h" #include "tests/CL/CLAccessor.h" -#include "tests/TypePrinter.h" #include "tests/benchmark/fixtures/LeNet5Fixture.h" #include "tests/framework/Macros.h" #include "tests/framework/datasets/Datasets.h" +#include "utils/TypePrinter.h" namespace arm_compute { diff --git a/tests/benchmark/NEON/ActivationLayer.cpp b/tests/benchmark/NEON/ActivationLayer.cpp index 0b699f2501..a00e7ec2e6 100644 --- a/tests/benchmark/NEON/ActivationLayer.cpp +++ b/tests/benchmark/NEON/ActivationLayer.cpp @@ -27,7 +27,6 @@ #include "arm_compute/runtime/Tensor.h" #include "arm_compute/runtime/TensorAllocator.h" #include "tests/NEON/Accessor.h" -#include "tests/TypePrinter.h" #include "tests/benchmark/fixtures/ActivationLayerFixture.h" #include "tests/datasets/system_tests/alexnet/AlexNetActivationLayerDataset.h" #include "tests/datasets/system_tests/googlenet/inceptionv1/GoogLeNetInceptionV1ActivationLayerDataset.h" @@ -38,6 +37,7 @@ #include "tests/datasets/system_tests/yolo/v2/YOLOV2ActivationLayerDataset.h" #include "tests/framework/Macros.h" #include "tests/framework/datasets/Datasets.h" +#include "utils/TypePrinter.h" namespace arm_compute { diff --git a/tests/benchmark/NEON/BatchNormalizationLayer.cpp b/tests/benchmark/NEON/BatchNormalizationLayer.cpp index 1b0d484404..5bfd234704 100644 --- a/tests/benchmark/NEON/BatchNormalizationLayer.cpp +++ b/tests/benchmark/NEON/BatchNormalizationLayer.cpp @@ -27,9 +27,9 @@ #include "arm_compute/runtime/Tensor.h" #include "arm_compute/runtime/TensorAllocator.h" #include "tests/NEON/Accessor.h" -#include "tests/TypePrinter.h" #include "tests/framework/Macros.h" #include "tests/framework/datasets/Datasets.h" +#include "utils/TypePrinter.h" #include "tests/benchmark/fixtures/BatchNormalizationLayerFixture.h" #include "tests/datasets/system_tests/googlenet/inceptionv4/GoogLeNetInceptionV4BatchNormalizationLayerDataset.h" diff --git a/tests/benchmark/NEON/ConvolutionLayer.cpp b/tests/benchmark/NEON/ConvolutionLayer.cpp index 6d2857d621..effcf63b8b 100644 --- a/tests/benchmark/NEON/ConvolutionLayer.cpp +++ b/tests/benchmark/NEON/ConvolutionLayer.cpp @@ -27,7 +27,6 @@ #include "arm_compute/runtime/Tensor.h" #include "arm_compute/runtime/TensorAllocator.h" #include "tests/NEON/Accessor.h" -#include "tests/TypePrinter.h" #include "tests/benchmark/fixtures/ConvolutionLayerFixture.h" #include "tests/datasets/system_tests/alexnet/AlexNetConvolutionLayerDataset.h" #include "tests/datasets/system_tests/googlenet/inceptionv1/GoogLeNetInceptionV1ConvolutionLayerDataset.h" @@ -38,6 +37,7 @@ #include "tests/datasets/system_tests/yolo/v2/YOLOV2ConvolutionLayerDataset.h" #include "tests/framework/Macros.h" #include "tests/framework/datasets/Datasets.h" +#include "utils/TypePrinter.h" namespace arm_compute { diff --git a/tests/benchmark/NEON/DirectConvolutionLayer.cpp b/tests/benchmark/NEON/DirectConvolutionLayer.cpp index a9dd4b94ea..e25a072599 100644 --- a/tests/benchmark/NEON/DirectConvolutionLayer.cpp +++ b/tests/benchmark/NEON/DirectConvolutionLayer.cpp @@ -27,7 +27,6 @@ #include "arm_compute/runtime/Tensor.h" #include "arm_compute/runtime/TensorAllocator.h" #include "tests/NEON/Accessor.h" -#include "tests/TypePrinter.h" #include "tests/benchmark/fixtures/ConvolutionLayerFixture.h" #include "tests/datasets/DirectConvolutionLayerDataset.h" #include "tests/datasets/system_tests/alexnet/AlexNetConvolutionLayerDataset.h" @@ -38,6 +37,7 @@ #include "tests/datasets/system_tests/yolo/v2/YOLOV2ConvolutionLayerDataset.h" #include "tests/framework/Macros.h" #include "tests/framework/datasets/Datasets.h" +#include "utils/TypePrinter.h" namespace arm_compute { diff --git a/tests/benchmark/NEON/Floor.cpp b/tests/benchmark/NEON/Floor.cpp index 4bc0c05fdc..824aee95ec 100644 --- a/tests/benchmark/NEON/Floor.cpp +++ b/tests/benchmark/NEON/Floor.cpp @@ -27,11 +27,11 @@ #include "arm_compute/runtime/Tensor.h" #include "arm_compute/runtime/TensorAllocator.h" #include "tests/NEON/Accessor.h" -#include "tests/TypePrinter.h" #include "tests/benchmark/fixtures/FloorFixture.h" #include "tests/datasets/ShapeDatasets.h" #include "tests/framework/Macros.h" #include "tests/framework/datasets/Datasets.h" +#include "utils/TypePrinter.h" namespace arm_compute { diff --git a/tests/benchmark/NEON/FullyConnectedLayer.cpp b/tests/benchmark/NEON/FullyConnectedLayer.cpp index 88499b1b6f..c12d7cedb9 100644 --- a/tests/benchmark/NEON/FullyConnectedLayer.cpp +++ b/tests/benchmark/NEON/FullyConnectedLayer.cpp @@ -27,7 +27,6 @@ #include "arm_compute/runtime/Tensor.h" #include "arm_compute/runtime/TensorAllocator.h" #include "tests/NEON/Accessor.h" -#include "tests/TypePrinter.h" #include "tests/benchmark/fixtures/FullyConnectedLayerFixture.h" #include "tests/datasets/system_tests/alexnet/AlexNetFullyConnectedLayerDataset.h" #include "tests/datasets/system_tests/googlenet/inceptionv1/GoogLeNetInceptionV1FullyConnectedLayerDataset.h" @@ -36,6 +35,7 @@ #include "tests/datasets/system_tests/vgg/vgg16/VGG16FullyConnectedLayerDataset.h" #include "tests/framework/Macros.h" #include "tests/framework/datasets/Datasets.h" +#include "utils/TypePrinter.h" namespace arm_compute { diff --git a/tests/benchmark/NEON/GEMM.cpp b/tests/benchmark/NEON/GEMM.cpp index 2c5a726784..ddc54e633e 100644 --- a/tests/benchmark/NEON/GEMM.cpp +++ b/tests/benchmark/NEON/GEMM.cpp @@ -27,12 +27,12 @@ #include "arm_compute/runtime/Tensor.h" #include "arm_compute/runtime/TensorAllocator.h" #include "tests/NEON/Accessor.h" -#include "tests/TypePrinter.h" #include "tests/benchmark/fixtures/GEMMFixture.h" #include "tests/datasets/MatrixMultiplyGEMMDataset.h" #include "tests/datasets/system_tests/googlenet/inceptionv1/GoogLeNetInceptionV1GEMMDataset.h" #include "tests/framework/Macros.h" #include "tests/framework/datasets/Datasets.h" +#include "utils/TypePrinter.h" namespace arm_compute { diff --git a/tests/benchmark/NEON/NormalizationLayer.cpp b/tests/benchmark/NEON/NormalizationLayer.cpp index 04887951bd..383cec98d0 100644 --- a/tests/benchmark/NEON/NormalizationLayer.cpp +++ b/tests/benchmark/NEON/NormalizationLayer.cpp @@ -27,12 +27,12 @@ #include "arm_compute/runtime/Tensor.h" #include "arm_compute/runtime/TensorAllocator.h" #include "tests/NEON/Accessor.h" -#include "tests/TypePrinter.h" #include "tests/benchmark/fixtures/NormalizationLayerFixture.h" #include "tests/datasets/system_tests/alexnet/AlexNetNormalizationLayerDataset.h" #include "tests/datasets/system_tests/googlenet/inceptionv1/GoogLeNetInceptionV1NormalizationLayerDataset.h" #include "tests/framework/Macros.h" #include "tests/framework/datasets/Datasets.h" +#include "utils/TypePrinter.h" namespace arm_compute { diff --git a/tests/benchmark/NEON/PoolingLayer.cpp b/tests/benchmark/NEON/PoolingLayer.cpp index 05a173b283..8d4e0a086d 100644 --- a/tests/benchmark/NEON/PoolingLayer.cpp +++ b/tests/benchmark/NEON/PoolingLayer.cpp @@ -27,7 +27,6 @@ #include "arm_compute/runtime/Tensor.h" #include "arm_compute/runtime/TensorAllocator.h" #include "tests/NEON/Accessor.h" -#include "tests/TypePrinter.h" #include "tests/benchmark/fixtures/PoolingLayerFixture.h" #include "tests/datasets/system_tests/alexnet/AlexNetPoolingLayerDataset.h" #include "tests/datasets/system_tests/googlenet/inceptionv1/GoogLeNetInceptionV1PoolingLayerDataset.h" @@ -38,6 +37,7 @@ #include "tests/datasets/system_tests/yolo/v2/YOLOV2PoolingLayerDataset.h" #include "tests/framework/Macros.h" #include "tests/framework/datasets/Datasets.h" +#include "utils/TypePrinter.h" namespace arm_compute { diff --git a/tests/benchmark/NEON/ROIPoolingLayer.cpp b/tests/benchmark/NEON/ROIPoolingLayer.cpp index d3a7e4b3af..64b3570715 100644 --- a/tests/benchmark/NEON/ROIPoolingLayer.cpp +++ b/tests/benchmark/NEON/ROIPoolingLayer.cpp @@ -29,11 +29,11 @@ #include "arm_compute/runtime/TensorAllocator.h" #include "tests/NEON/Accessor.h" #include "tests/NEON/ArrayAccessor.h" -#include "tests/TypePrinter.h" #include "tests/benchmark/fixtures/ROIPoolingLayerFixture.h" #include "tests/datasets/ROIPoolingLayerDataset.h" #include "tests/framework/Macros.h" #include "tests/framework/datasets/Datasets.h" +#include "utils/TypePrinter.h" namespace arm_compute { diff --git a/tests/benchmark/NEON/SYSTEM/AlexNet.cpp b/tests/benchmark/NEON/SYSTEM/AlexNet.cpp index cd48e5db25..19598e3ca5 100644 --- a/tests/benchmark/NEON/SYSTEM/AlexNet.cpp +++ b/tests/benchmark/NEON/SYSTEM/AlexNet.cpp @@ -34,10 +34,10 @@ #include "arm_compute/runtime/Tensor.h" #include "arm_compute/runtime/TensorAllocator.h" #include "tests/NEON/Accessor.h" -#include "tests/TypePrinter.h" #include "tests/benchmark/fixtures/AlexNetFixture.h" #include "tests/framework/Macros.h" #include "tests/framework/datasets/Datasets.h" +#include "utils/TypePrinter.h" namespace arm_compute { diff --git a/tests/benchmark/NEON/SYSTEM/LeNet5.cpp b/tests/benchmark/NEON/SYSTEM/LeNet5.cpp index 46ccfc01d5..5075da50cf 100644 --- a/tests/benchmark/NEON/SYSTEM/LeNet5.cpp +++ b/tests/benchmark/NEON/SYSTEM/LeNet5.cpp @@ -31,10 +31,10 @@ #include "arm_compute/runtime/Tensor.h" #include "arm_compute/runtime/TensorAllocator.h" #include "tests/NEON/Accessor.h" -#include "tests/TypePrinter.h" #include "tests/benchmark/fixtures/LeNet5Fixture.h" #include "tests/framework/Macros.h" #include "tests/framework/datasets/Datasets.h" +#include "utils/TypePrinter.h" namespace arm_compute { diff --git a/tests/datasets/BatchNormalizationLayerDataset.h b/tests/datasets/BatchNormalizationLayerDataset.h index 25e65d931c..fceff1edc7 100644 --- a/tests/datasets/BatchNormalizationLayerDataset.h +++ b/tests/datasets/BatchNormalizationLayerDataset.h @@ -24,7 +24,7 @@ #ifndef ARM_COMPUTE_TEST_BATCHNORMALIZATION_LAYER_DATASET #define ARM_COMPUTE_TEST_BATCHNORMALIZATION_LAYER_DATASET -#include "tests/TypePrinter.h" +#include "utils/TypePrinter.h" #include "arm_compute/core/TensorShape.h" #include "arm_compute/core/Types.h" diff --git a/tests/datasets/BorderModeDataset.h b/tests/datasets/BorderModeDataset.h index df024a7dbf..3b8a08ce61 100644 --- a/tests/datasets/BorderModeDataset.h +++ b/tests/datasets/BorderModeDataset.h @@ -27,6 +27,13 @@ #include "arm_compute/core/Types.h" #include "tests/framework/datasets/ContainerDataset.h" +#include "utils/TypePrinter.h" + +#include "arm_compute/core/TensorShape.h" +#include "arm_compute/core/Types.h" + +#include "arm_compute/core/TensorShape.h" +#include "arm_compute/core/Types.h" #include namespace arm_compute diff --git a/tests/datasets/ConvolutionLayerDataset.h b/tests/datasets/ConvolutionLayerDataset.h index ba11bd5d6d..6e2d2a142e 100644 --- a/tests/datasets/ConvolutionLayerDataset.h +++ b/tests/datasets/ConvolutionLayerDataset.h @@ -24,7 +24,7 @@ #ifndef ARM_COMPUTE_TEST_CONVOLUTION_LAYER_DATASET #define ARM_COMPUTE_TEST_CONVOLUTION_LAYER_DATASET -#include "tests/TypePrinter.h" +#include "utils/TypePrinter.h" #include "arm_compute/core/TensorShape.h" #include "arm_compute/core/Types.h" diff --git a/tests/datasets/DepthwiseConvolutionDataset.h b/tests/datasets/DepthwiseConvolutionDataset.h index bdc949501e..6a7af63d05 100644 --- a/tests/datasets/DepthwiseConvolutionDataset.h +++ b/tests/datasets/DepthwiseConvolutionDataset.h @@ -24,7 +24,7 @@ #ifndef ARM_COMPUTE_TEST_DEPTHWISE_CONVOLUTION_DATASET #define ARM_COMPUTE_TEST_DEPTHWISE_CONVOLUTION_DATASET -#include "tests/TypePrinter.h" +#include "utils/TypePrinter.h" #include "arm_compute/core/TensorShape.h" #include "arm_compute/core/Types.h" diff --git a/tests/datasets/DepthwiseSeparableConvolutionLayerDataset.h b/tests/datasets/DepthwiseSeparableConvolutionLayerDataset.h index 4391379833..6b39d3a5c8 100644 --- a/tests/datasets/DepthwiseSeparableConvolutionLayerDataset.h +++ b/tests/datasets/DepthwiseSeparableConvolutionLayerDataset.h @@ -24,7 +24,7 @@ #ifndef ARM_COMPUTE_TEST_DEPTHWISE_SEPARABLE_CONVOLUTION_LAYER_DATASET #define ARM_COMPUTE_TEST_DEPTHWISE_SEPARABLE_CONVOLUTION_LAYER_DATASET -#include "tests/TypePrinter.h" +#include "utils/TypePrinter.h" #include "arm_compute/core/TensorShape.h" #include "arm_compute/core/Types.h" diff --git a/tests/datasets/DirectConvolutionLayerDataset.h b/tests/datasets/DirectConvolutionLayerDataset.h index dca38b5858..294f44fa42 100644 --- a/tests/datasets/DirectConvolutionLayerDataset.h +++ b/tests/datasets/DirectConvolutionLayerDataset.h @@ -26,7 +26,7 @@ #include "tests/datasets/ConvolutionLayerDataset.h" -#include "tests/TypePrinter.h" +#include "utils/TypePrinter.h" #include "arm_compute/core/TensorShape.h" #include "arm_compute/core/Types.h" diff --git a/tests/datasets/FullyConnectedLayerDataset.h b/tests/datasets/FullyConnectedLayerDataset.h index 8401e39ece..5789954e85 100644 --- a/tests/datasets/FullyConnectedLayerDataset.h +++ b/tests/datasets/FullyConnectedLayerDataset.h @@ -24,7 +24,7 @@ #ifndef ARM_COMPUTE_TEST_FULLYCONNECTED_LAYER_DATASET #define ARM_COMPUTE_TEST_FULLYCONNECTED_LAYER_DATASET -#include "tests/TypePrinter.h" +#include "utils/TypePrinter.h" #include "arm_compute/core/TensorShape.h" #include "arm_compute/core/Types.h" diff --git a/tests/datasets/GEMMDataset.h b/tests/datasets/GEMMDataset.h index bb8a328b0c..9491582641 100644 --- a/tests/datasets/GEMMDataset.h +++ b/tests/datasets/GEMMDataset.h @@ -24,7 +24,7 @@ #ifndef ARM_COMPUTE_TEST_GEMM_DATASET #define ARM_COMPUTE_TEST_GEMM_DATASET -#include "tests/TypePrinter.h" +#include "utils/TypePrinter.h" #include "arm_compute/core/TensorShape.h" diff --git a/tests/datasets/LargeConvolutionLayerDataset.h b/tests/datasets/LargeConvolutionLayerDataset.h index 721530ae19..086b2e3def 100644 --- a/tests/datasets/LargeConvolutionLayerDataset.h +++ b/tests/datasets/LargeConvolutionLayerDataset.h @@ -26,7 +26,7 @@ #include "tests/datasets/ConvolutionLayerDataset.h" -#include "tests/TypePrinter.h" +#include "utils/TypePrinter.h" #include "arm_compute/core/TensorShape.h" #include "arm_compute/core/Types.h" diff --git a/tests/datasets/LargeGEMMDataset.h b/tests/datasets/LargeGEMMDataset.h index 37cdfaa99f..638eb904ad 100644 --- a/tests/datasets/LargeGEMMDataset.h +++ b/tests/datasets/LargeGEMMDataset.h @@ -26,7 +26,7 @@ #include "tests/datasets/GEMMDataset.h" -#include "tests/TypePrinter.h" +#include "utils/TypePrinter.h" #include "arm_compute/core/TensorShape.h" #include "arm_compute/core/Types.h" diff --git a/tests/datasets/MatrixMultiplyGEMMDataset.h b/tests/datasets/MatrixMultiplyGEMMDataset.h index 771403ba96..718c32b466 100644 --- a/tests/datasets/MatrixMultiplyGEMMDataset.h +++ b/tests/datasets/MatrixMultiplyGEMMDataset.h @@ -26,7 +26,7 @@ #include "tests/datasets/GEMMDataset.h" -#include "tests/TypePrinter.h" +#include "utils/TypePrinter.h" #include "arm_compute/core/TensorShape.h" diff --git a/tests/datasets/MatrixPatternDataset.h b/tests/datasets/MatrixPatternDataset.h index 4c1414996d..423aeb8627 100644 --- a/tests/datasets/MatrixPatternDataset.h +++ b/tests/datasets/MatrixPatternDataset.h @@ -27,6 +27,13 @@ #include "arm_compute/core/Types.h" #include "tests/framework/datasets/ContainerDataset.h" +#include "utils/TypePrinter.h" + +#include "arm_compute/core/TensorShape.h" +#include "arm_compute/core/Types.h" + +#include "arm_compute/core/TensorShape.h" +#include "arm_compute/core/Types.h" #include namespace arm_compute diff --git a/tests/datasets/MobileNetDepthwiseConvolutionDataset.h b/tests/datasets/MobileNetDepthwiseConvolutionDataset.h index c417f18a51..c9d98d4185 100644 --- a/tests/datasets/MobileNetDepthwiseConvolutionDataset.h +++ b/tests/datasets/MobileNetDepthwiseConvolutionDataset.h @@ -26,7 +26,7 @@ #include "tests/datasets/DepthwiseConvolutionDataset.h" -#include "tests/TypePrinter.h" +#include "utils/TypePrinter.h" #include "arm_compute/core/TensorShape.h" #include "arm_compute/core/Types.h" diff --git a/tests/datasets/MobileNetDepthwiseSeparableConvolutionLayerDataset.h b/tests/datasets/MobileNetDepthwiseSeparableConvolutionLayerDataset.h index c7784c399c..f6137ee74c 100644 --- a/tests/datasets/MobileNetDepthwiseSeparableConvolutionLayerDataset.h +++ b/tests/datasets/MobileNetDepthwiseSeparableConvolutionLayerDataset.h @@ -26,7 +26,7 @@ #include "tests/datasets/DepthwiseSeparableConvolutionLayerDataset.h" -#include "tests/TypePrinter.h" +#include "utils/TypePrinter.h" #include "arm_compute/core/TensorShape.h" #include "arm_compute/core/Types.h" diff --git a/tests/datasets/PoolingLayerDataset.h b/tests/datasets/PoolingLayerDataset.h index e5e9cd70f0..56ec3b87d8 100644 --- a/tests/datasets/PoolingLayerDataset.h +++ b/tests/datasets/PoolingLayerDataset.h @@ -26,7 +26,7 @@ #include "arm_compute/core/TensorShape.h" #include "arm_compute/core/Types.h" -#include "tests/TypePrinter.h" +#include "utils/TypePrinter.h" namespace arm_compute { diff --git a/tests/datasets/ROIPoolingLayerDataset.h b/tests/datasets/ROIPoolingLayerDataset.h index 65d589eb97..a1879d3b54 100644 --- a/tests/datasets/ROIPoolingLayerDataset.h +++ b/tests/datasets/ROIPoolingLayerDataset.h @@ -24,7 +24,7 @@ #ifndef ARM_COMPUTE_TEST_ROI_POOLING_LAYER_DATASET #define ARM_COMPUTE_TEST_ROI_POOLING_LAYER_DATASET -#include "tests/TypePrinter.h" +#include "utils/TypePrinter.h" #include "arm_compute/core/TensorShape.h" #include "arm_compute/core/Types.h" diff --git a/tests/datasets/RandomBatchNormalizationLayerDataset.h b/tests/datasets/RandomBatchNormalizationLayerDataset.h index f4c61e06d5..10908871b6 100644 --- a/tests/datasets/RandomBatchNormalizationLayerDataset.h +++ b/tests/datasets/RandomBatchNormalizationLayerDataset.h @@ -26,7 +26,7 @@ #include "tests/datasets/BatchNormalizationLayerDataset.h" -#include "tests/TypePrinter.h" +#include "utils/TypePrinter.h" #include "arm_compute/core/TensorShape.h" #include "arm_compute/core/Types.h" diff --git a/tests/datasets/ReductionOperationDataset.h b/tests/datasets/ReductionOperationDataset.h index ce1bcb8501..e710588921 100644 --- a/tests/datasets/ReductionOperationDataset.h +++ b/tests/datasets/ReductionOperationDataset.h @@ -25,8 +25,8 @@ #define __ARM_COMPUTE_TEST_REDUCTION_OPERATION_DATASET_H__ #include "arm_compute/core/Types.h" -#include "tests/TypePrinter.h" #include "tests/framework/datasets/ContainerDataset.h" +#include "utils/TypePrinter.h" #include diff --git a/tests/datasets/ReshapeLayerDataset.h b/tests/datasets/ReshapeLayerDataset.h index db7b0b3e57..fa938a63ed 100644 --- a/tests/datasets/ReshapeLayerDataset.h +++ b/tests/datasets/ReshapeLayerDataset.h @@ -24,7 +24,7 @@ #ifndef ARM_COMPUTE_TEST_RESHAPE_LAYER_DATASET #define ARM_COMPUTE_TEST_RESHAPE_LAYER_DATASET -#include "tests/TypePrinter.h" +#include "utils/TypePrinter.h" #include "arm_compute/core/TensorShape.h" diff --git a/tests/datasets/SmallConvolutionLayerDataset.h b/tests/datasets/SmallConvolutionLayerDataset.h index 1a26fa5917..8eda2e87fe 100644 --- a/tests/datasets/SmallConvolutionLayerDataset.h +++ b/tests/datasets/SmallConvolutionLayerDataset.h @@ -26,7 +26,7 @@ #include "tests/datasets/ConvolutionLayerDataset.h" -#include "tests/TypePrinter.h" +#include "utils/TypePrinter.h" #include "arm_compute/core/TensorShape.h" #include "arm_compute/core/Types.h" diff --git a/tests/datasets/SmallGEMMDataset.h b/tests/datasets/SmallGEMMDataset.h index 0cc3c3aa8c..5d59c1d3b3 100644 --- a/tests/datasets/SmallGEMMDataset.h +++ b/tests/datasets/SmallGEMMDataset.h @@ -26,7 +26,7 @@ #include "tests/datasets/GEMMDataset.h" -#include "tests/TypePrinter.h" +#include "utils/TypePrinter.h" #include "arm_compute/core/TensorShape.h" #include "arm_compute/core/Types.h" diff --git a/tests/datasets/system_tests/alexnet/AlexNetActivationLayerDataset.h b/tests/datasets/system_tests/alexnet/AlexNetActivationLayerDataset.h index 4030e97436..74c5fda235 100644 --- a/tests/datasets/system_tests/alexnet/AlexNetActivationLayerDataset.h +++ b/tests/datasets/system_tests/alexnet/AlexNetActivationLayerDataset.h @@ -26,7 +26,7 @@ #include "tests/framework/datasets/Datasets.h" -#include "tests/TypePrinter.h" +#include "utils/TypePrinter.h" #include "arm_compute/core/TensorShape.h" #include "arm_compute/core/Types.h" diff --git a/tests/datasets/system_tests/alexnet/AlexNetConvolutionLayerDataset.h b/tests/datasets/system_tests/alexnet/AlexNetConvolutionLayerDataset.h index d0b901a9a1..dcf96c7991 100644 --- a/tests/datasets/system_tests/alexnet/AlexNetConvolutionLayerDataset.h +++ b/tests/datasets/system_tests/alexnet/AlexNetConvolutionLayerDataset.h @@ -26,7 +26,7 @@ #include "tests/datasets/ConvolutionLayerDataset.h" -#include "tests/TypePrinter.h" +#include "utils/TypePrinter.h" #include "arm_compute/core/TensorShape.h" #include "arm_compute/core/Types.h" diff --git a/tests/datasets/system_tests/alexnet/AlexNetFullyConnectedLayerDataset.h b/tests/datasets/system_tests/alexnet/AlexNetFullyConnectedLayerDataset.h index 50b0f7d75d..3d43e6f7db 100644 --- a/tests/datasets/system_tests/alexnet/AlexNetFullyConnectedLayerDataset.h +++ b/tests/datasets/system_tests/alexnet/AlexNetFullyConnectedLayerDataset.h @@ -26,7 +26,7 @@ #include "tests/datasets/FullyConnectedLayerDataset.h" -#include "tests/TypePrinter.h" +#include "utils/TypePrinter.h" #include "arm_compute/core/TensorShape.h" #include "arm_compute/core/Types.h" diff --git a/tests/datasets/system_tests/alexnet/AlexNetNormalizationLayerDataset.h b/tests/datasets/system_tests/alexnet/AlexNetNormalizationLayerDataset.h index 33b7423442..6f68fd7722 100644 --- a/tests/datasets/system_tests/alexnet/AlexNetNormalizationLayerDataset.h +++ b/tests/datasets/system_tests/alexnet/AlexNetNormalizationLayerDataset.h @@ -26,7 +26,7 @@ #include "tests/framework/datasets/Datasets.h" -#include "tests/TypePrinter.h" +#include "utils/TypePrinter.h" #include "arm_compute/core/TensorShape.h" #include "arm_compute/core/Types.h" diff --git a/tests/datasets/system_tests/alexnet/AlexNetPoolingLayerDataset.h b/tests/datasets/system_tests/alexnet/AlexNetPoolingLayerDataset.h index ab2749b36e..739d24ca18 100644 --- a/tests/datasets/system_tests/alexnet/AlexNetPoolingLayerDataset.h +++ b/tests/datasets/system_tests/alexnet/AlexNetPoolingLayerDataset.h @@ -26,7 +26,7 @@ #include "tests/datasets/PoolingLayerDataset.h" -#include "tests/TypePrinter.h" +#include "utils/TypePrinter.h" #include "arm_compute/core/TensorShape.h" #include "arm_compute/core/Types.h" diff --git a/tests/datasets/system_tests/googlenet/inceptionv1/GoogLeNetInceptionV1ActivationLayerDataset.h b/tests/datasets/system_tests/googlenet/inceptionv1/GoogLeNetInceptionV1ActivationLayerDataset.h index dc4ffe4e4e..76087fa3d5 100644 --- a/tests/datasets/system_tests/googlenet/inceptionv1/GoogLeNetInceptionV1ActivationLayerDataset.h +++ b/tests/datasets/system_tests/googlenet/inceptionv1/GoogLeNetInceptionV1ActivationLayerDataset.h @@ -26,7 +26,7 @@ #include "tests/framework/datasets/Datasets.h" -#include "tests/TypePrinter.h" +#include "utils/TypePrinter.h" #include "arm_compute/core/TensorShape.h" #include "arm_compute/core/Types.h" diff --git a/tests/datasets/system_tests/googlenet/inceptionv1/GoogLeNetInceptionV1ConvolutionLayerDataset.h b/tests/datasets/system_tests/googlenet/inceptionv1/GoogLeNetInceptionV1ConvolutionLayerDataset.h index a4002d124d..1415ff1daa 100644 --- a/tests/datasets/system_tests/googlenet/inceptionv1/GoogLeNetInceptionV1ConvolutionLayerDataset.h +++ b/tests/datasets/system_tests/googlenet/inceptionv1/GoogLeNetInceptionV1ConvolutionLayerDataset.h @@ -26,7 +26,7 @@ #include "tests/datasets/ConvolutionLayerDataset.h" -#include "tests/TypePrinter.h" +#include "utils/TypePrinter.h" #include "arm_compute/core/TensorShape.h" #include "arm_compute/core/Types.h" diff --git a/tests/datasets/system_tests/googlenet/inceptionv1/GoogLeNetInceptionV1FullyConnectedLayerDataset.h b/tests/datasets/system_tests/googlenet/inceptionv1/GoogLeNetInceptionV1FullyConnectedLayerDataset.h index 80a3473bc7..cde9ae6179 100644 --- a/tests/datasets/system_tests/googlenet/inceptionv1/GoogLeNetInceptionV1FullyConnectedLayerDataset.h +++ b/tests/datasets/system_tests/googlenet/inceptionv1/GoogLeNetInceptionV1FullyConnectedLayerDataset.h @@ -26,7 +26,7 @@ #include "tests/datasets/FullyConnectedLayerDataset.h" -#include "tests/TypePrinter.h" +#include "utils/TypePrinter.h" #include "arm_compute/core/TensorShape.h" #include "arm_compute/core/Types.h" diff --git a/tests/datasets/system_tests/googlenet/inceptionv1/GoogLeNetInceptionV1GEMMDataset.h b/tests/datasets/system_tests/googlenet/inceptionv1/GoogLeNetInceptionV1GEMMDataset.h index 806ca9378a..3b5c9acc8a 100644 --- a/tests/datasets/system_tests/googlenet/inceptionv1/GoogLeNetInceptionV1GEMMDataset.h +++ b/tests/datasets/system_tests/googlenet/inceptionv1/GoogLeNetInceptionV1GEMMDataset.h @@ -26,7 +26,7 @@ #include "tests/datasets/GEMMDataset.h" -#include "tests/TypePrinter.h" +#include "utils/TypePrinter.h" #include "arm_compute/core/TensorShape.h" diff --git a/tests/datasets/system_tests/googlenet/inceptionv1/GoogLeNetInceptionV1NormalizationLayerDataset.h b/tests/datasets/system_tests/googlenet/inceptionv1/GoogLeNetInceptionV1NormalizationLayerDataset.h index d8fd061b66..eb6903faef 100644 --- a/tests/datasets/system_tests/googlenet/inceptionv1/GoogLeNetInceptionV1NormalizationLayerDataset.h +++ b/tests/datasets/system_tests/googlenet/inceptionv1/GoogLeNetInceptionV1NormalizationLayerDataset.h @@ -26,7 +26,7 @@ #include "tests/framework/datasets/Datasets.h" -#include "tests/TypePrinter.h" +#include "utils/TypePrinter.h" #include "arm_compute/core/TensorShape.h" #include "arm_compute/core/Types.h" diff --git a/tests/datasets/system_tests/googlenet/inceptionv1/GoogLeNetInceptionV1PoolingLayerDataset.h b/tests/datasets/system_tests/googlenet/inceptionv1/GoogLeNetInceptionV1PoolingLayerDataset.h index 6164bbacea..b775667ac8 100644 --- a/tests/datasets/system_tests/googlenet/inceptionv1/GoogLeNetInceptionV1PoolingLayerDataset.h +++ b/tests/datasets/system_tests/googlenet/inceptionv1/GoogLeNetInceptionV1PoolingLayerDataset.h @@ -26,7 +26,7 @@ #include "tests/datasets/PoolingLayerDataset.h" -#include "tests/TypePrinter.h" +#include "utils/TypePrinter.h" #include "arm_compute/core/TensorShape.h" #include "arm_compute/core/Types.h" diff --git a/tests/datasets/system_tests/googlenet/inceptionv4/GoogLeNetInceptionV4ActivationLayerDataset.h b/tests/datasets/system_tests/googlenet/inceptionv4/GoogLeNetInceptionV4ActivationLayerDataset.h index 2d586390ec..395b1f9866 100644 --- a/tests/datasets/system_tests/googlenet/inceptionv4/GoogLeNetInceptionV4ActivationLayerDataset.h +++ b/tests/datasets/system_tests/googlenet/inceptionv4/GoogLeNetInceptionV4ActivationLayerDataset.h @@ -26,7 +26,7 @@ #include "tests/framework/datasets/Datasets.h" -#include "tests/TypePrinter.h" +#include "utils/TypePrinter.h" #include "arm_compute/core/TensorShape.h" #include "arm_compute/core/Types.h" diff --git a/tests/datasets/system_tests/googlenet/inceptionv4/GoogLeNetInceptionV4BatchNormalizationLayerDataset.h b/tests/datasets/system_tests/googlenet/inceptionv4/GoogLeNetInceptionV4BatchNormalizationLayerDataset.h index d96410f9eb..3a22c7807f 100644 --- a/tests/datasets/system_tests/googlenet/inceptionv4/GoogLeNetInceptionV4BatchNormalizationLayerDataset.h +++ b/tests/datasets/system_tests/googlenet/inceptionv4/GoogLeNetInceptionV4BatchNormalizationLayerDataset.h @@ -26,7 +26,7 @@ #include "tests/datasets/BatchNormalizationLayerDataset.h" -#include "tests/TypePrinter.h" +#include "utils/TypePrinter.h" #include "arm_compute/core/TensorShape.h" #include "arm_compute/core/Types.h" diff --git a/tests/datasets/system_tests/googlenet/inceptionv4/GoogLeNetInceptionV4ConvolutionLayerDataset.h b/tests/datasets/system_tests/googlenet/inceptionv4/GoogLeNetInceptionV4ConvolutionLayerDataset.h index a050d3da74..3dd8a7c348 100644 --- a/tests/datasets/system_tests/googlenet/inceptionv4/GoogLeNetInceptionV4ConvolutionLayerDataset.h +++ b/tests/datasets/system_tests/googlenet/inceptionv4/GoogLeNetInceptionV4ConvolutionLayerDataset.h @@ -26,7 +26,7 @@ #include "tests/datasets/ConvolutionLayerDataset.h" -#include "tests/TypePrinter.h" +#include "utils/TypePrinter.h" #include "arm_compute/core/TensorShape.h" #include "arm_compute/core/Types.h" diff --git a/tests/datasets/system_tests/googlenet/inceptionv4/GoogLeNetInceptionV4FullyConnectedLayerDataset.h b/tests/datasets/system_tests/googlenet/inceptionv4/GoogLeNetInceptionV4FullyConnectedLayerDataset.h index 8cf59e8207..5a0af2b6c5 100644 --- a/tests/datasets/system_tests/googlenet/inceptionv4/GoogLeNetInceptionV4FullyConnectedLayerDataset.h +++ b/tests/datasets/system_tests/googlenet/inceptionv4/GoogLeNetInceptionV4FullyConnectedLayerDataset.h @@ -26,7 +26,7 @@ #include "tests/datasets/FullyConnectedLayerDataset.h" -#include "tests/TypePrinter.h" +#include "utils/TypePrinter.h" #include "arm_compute/core/TensorShape.h" #include "arm_compute/core/Types.h" diff --git a/tests/datasets/system_tests/googlenet/inceptionv4/GoogLeNetInceptionV4PoolingLayerDataset.h b/tests/datasets/system_tests/googlenet/inceptionv4/GoogLeNetInceptionV4PoolingLayerDataset.h index 3b1ee8dcb4..a58fd797ec 100644 --- a/tests/datasets/system_tests/googlenet/inceptionv4/GoogLeNetInceptionV4PoolingLayerDataset.h +++ b/tests/datasets/system_tests/googlenet/inceptionv4/GoogLeNetInceptionV4PoolingLayerDataset.h @@ -26,7 +26,7 @@ #include "tests/datasets/PoolingLayerDataset.h" -#include "tests/TypePrinter.h" +#include "utils/TypePrinter.h" #include "arm_compute/core/TensorShape.h" #include "arm_compute/core/Types.h" diff --git a/tests/datasets/system_tests/lenet5/LeNet5ActivationLayerDataset.h b/tests/datasets/system_tests/lenet5/LeNet5ActivationLayerDataset.h index 4c88cde58d..021bfee18b 100644 --- a/tests/datasets/system_tests/lenet5/LeNet5ActivationLayerDataset.h +++ b/tests/datasets/system_tests/lenet5/LeNet5ActivationLayerDataset.h @@ -26,7 +26,7 @@ #include "tests/framework/datasets/Datasets.h" -#include "tests/TypePrinter.h" +#include "utils/TypePrinter.h" #include "arm_compute/core/TensorShape.h" #include "arm_compute/core/Types.h" diff --git a/tests/datasets/system_tests/lenet5/LeNet5ConvolutionLayerDataset.h b/tests/datasets/system_tests/lenet5/LeNet5ConvolutionLayerDataset.h index e1d3ead65b..3f28627b08 100644 --- a/tests/datasets/system_tests/lenet5/LeNet5ConvolutionLayerDataset.h +++ b/tests/datasets/system_tests/lenet5/LeNet5ConvolutionLayerDataset.h @@ -26,7 +26,7 @@ #include "tests/datasets/ConvolutionLayerDataset.h" -#include "tests/TypePrinter.h" +#include "utils/TypePrinter.h" #include "arm_compute/core/TensorShape.h" #include "arm_compute/core/Types.h" diff --git a/tests/datasets/system_tests/lenet5/LeNet5FullyConnectedLayerDataset.h b/tests/datasets/system_tests/lenet5/LeNet5FullyConnectedLayerDataset.h index 343ecc0190..74e8d2ce7b 100644 --- a/tests/datasets/system_tests/lenet5/LeNet5FullyConnectedLayerDataset.h +++ b/tests/datasets/system_tests/lenet5/LeNet5FullyConnectedLayerDataset.h @@ -26,7 +26,7 @@ #include "tests/datasets/FullyConnectedLayerDataset.h" -#include "tests/TypePrinter.h" +#include "utils/TypePrinter.h" #include "arm_compute/core/TensorShape.h" #include "arm_compute/core/Types.h" diff --git a/tests/datasets/system_tests/lenet5/LeNet5PoolingLayerDataset.h b/tests/datasets/system_tests/lenet5/LeNet5PoolingLayerDataset.h index bc2de7b235..bcd11dc5b9 100644 --- a/tests/datasets/system_tests/lenet5/LeNet5PoolingLayerDataset.h +++ b/tests/datasets/system_tests/lenet5/LeNet5PoolingLayerDataset.h @@ -26,7 +26,7 @@ #include "tests/datasets/PoolingLayerDataset.h" -#include "tests/TypePrinter.h" +#include "utils/TypePrinter.h" #include "arm_compute/core/TensorShape.h" #include "arm_compute/core/Types.h" diff --git a/tests/datasets/system_tests/squeezenet/SqueezeNetActivationLayerDataset.h b/tests/datasets/system_tests/squeezenet/SqueezeNetActivationLayerDataset.h index 7644387384..7f4bf4d549 100644 --- a/tests/datasets/system_tests/squeezenet/SqueezeNetActivationLayerDataset.h +++ b/tests/datasets/system_tests/squeezenet/SqueezeNetActivationLayerDataset.h @@ -26,7 +26,7 @@ #include "tests/framework/datasets/Datasets.h" -#include "tests/TypePrinter.h" +#include "utils/TypePrinter.h" #include "arm_compute/core/TensorShape.h" #include "arm_compute/core/Types.h" diff --git a/tests/datasets/system_tests/squeezenet/SqueezeNetConvolutionLayerDataset.h b/tests/datasets/system_tests/squeezenet/SqueezeNetConvolutionLayerDataset.h index 2d447b0156..2bb9db7240 100644 --- a/tests/datasets/system_tests/squeezenet/SqueezeNetConvolutionLayerDataset.h +++ b/tests/datasets/system_tests/squeezenet/SqueezeNetConvolutionLayerDataset.h @@ -26,7 +26,7 @@ #include "tests/datasets/ConvolutionLayerDataset.h" -#include "tests/TypePrinter.h" +#include "utils/TypePrinter.h" #include "arm_compute/core/TensorShape.h" #include "arm_compute/core/Types.h" diff --git a/tests/datasets/system_tests/squeezenet/SqueezeNetPoolingLayerDataset.h b/tests/datasets/system_tests/squeezenet/SqueezeNetPoolingLayerDataset.h index 69d04db7e1..cb2edbc5ec 100644 --- a/tests/datasets/system_tests/squeezenet/SqueezeNetPoolingLayerDataset.h +++ b/tests/datasets/system_tests/squeezenet/SqueezeNetPoolingLayerDataset.h @@ -26,7 +26,7 @@ #include "tests/datasets/PoolingLayerDataset.h" -#include "tests/TypePrinter.h" +#include "utils/TypePrinter.h" #include "arm_compute/core/TensorShape.h" #include "arm_compute/core/Types.h" diff --git a/tests/datasets/system_tests/vgg/vgg16/VGG16ActivationLayerDataset.h b/tests/datasets/system_tests/vgg/vgg16/VGG16ActivationLayerDataset.h index 66301ddf08..93de996b6c 100644 --- a/tests/datasets/system_tests/vgg/vgg16/VGG16ActivationLayerDataset.h +++ b/tests/datasets/system_tests/vgg/vgg16/VGG16ActivationLayerDataset.h @@ -26,7 +26,7 @@ #include "tests/framework/datasets/Datasets.h" -#include "tests/TypePrinter.h" +#include "utils/TypePrinter.h" #include "arm_compute/core/TensorShape.h" #include "arm_compute/core/Types.h" diff --git a/tests/datasets/system_tests/vgg/vgg16/VGG16ConvolutionLayerDataset.h b/tests/datasets/system_tests/vgg/vgg16/VGG16ConvolutionLayerDataset.h index 36cb5d93aa..fe31da287c 100644 --- a/tests/datasets/system_tests/vgg/vgg16/VGG16ConvolutionLayerDataset.h +++ b/tests/datasets/system_tests/vgg/vgg16/VGG16ConvolutionLayerDataset.h @@ -26,7 +26,7 @@ #include "tests/datasets/ConvolutionLayerDataset.h" -#include "tests/TypePrinter.h" +#include "utils/TypePrinter.h" #include "arm_compute/core/TensorShape.h" #include "arm_compute/core/Types.h" diff --git a/tests/datasets/system_tests/vgg/vgg16/VGG16FullyConnectedLayerDataset.h b/tests/datasets/system_tests/vgg/vgg16/VGG16FullyConnectedLayerDataset.h index d34dc3f87e..3b40b34653 100644 --- a/tests/datasets/system_tests/vgg/vgg16/VGG16FullyConnectedLayerDataset.h +++ b/tests/datasets/system_tests/vgg/vgg16/VGG16FullyConnectedLayerDataset.h @@ -26,7 +26,7 @@ #include "tests/datasets/FullyConnectedLayerDataset.h" -#include "tests/TypePrinter.h" +#include "utils/TypePrinter.h" #include "arm_compute/core/TensorShape.h" #include "arm_compute/core/Types.h" diff --git a/tests/datasets/system_tests/vgg/vgg16/VGG16PoolingLayerDataset.h b/tests/datasets/system_tests/vgg/vgg16/VGG16PoolingLayerDataset.h index 4db20870f2..affbcc5022 100644 --- a/tests/datasets/system_tests/vgg/vgg16/VGG16PoolingLayerDataset.h +++ b/tests/datasets/system_tests/vgg/vgg16/VGG16PoolingLayerDataset.h @@ -26,7 +26,7 @@ #include "tests/datasets/PoolingLayerDataset.h" -#include "tests/TypePrinter.h" +#include "utils/TypePrinter.h" #include "arm_compute/core/TensorShape.h" #include "arm_compute/core/Types.h" diff --git a/tests/datasets/system_tests/yolo/v2/YOLOV2ActivationLayerDataset.h b/tests/datasets/system_tests/yolo/v2/YOLOV2ActivationLayerDataset.h index 8a2cd1665e..f30069e55d 100644 --- a/tests/datasets/system_tests/yolo/v2/YOLOV2ActivationLayerDataset.h +++ b/tests/datasets/system_tests/yolo/v2/YOLOV2ActivationLayerDataset.h @@ -26,7 +26,7 @@ #include "tests/framework/datasets/Datasets.h" -#include "tests/TypePrinter.h" +#include "utils/TypePrinter.h" #include "arm_compute/core/TensorShape.h" #include "arm_compute/core/Types.h" diff --git a/tests/datasets/system_tests/yolo/v2/YOLOV2BatchNormalizationLayerDataset.h b/tests/datasets/system_tests/yolo/v2/YOLOV2BatchNormalizationLayerDataset.h index cc6a6dcccc..4d2cba8b4b 100644 --- a/tests/datasets/system_tests/yolo/v2/YOLOV2BatchNormalizationLayerDataset.h +++ b/tests/datasets/system_tests/yolo/v2/YOLOV2BatchNormalizationLayerDataset.h @@ -26,7 +26,7 @@ #include "tests/datasets/BatchNormalizationLayerDataset.h" -#include "tests/TypePrinter.h" +#include "utils/TypePrinter.h" #include "arm_compute/core/TensorShape.h" #include "arm_compute/core/Types.h" diff --git a/tests/datasets/system_tests/yolo/v2/YOLOV2ConvolutionLayerDataset.h b/tests/datasets/system_tests/yolo/v2/YOLOV2ConvolutionLayerDataset.h index 41f48b0958..b4cb3577e8 100644 --- a/tests/datasets/system_tests/yolo/v2/YOLOV2ConvolutionLayerDataset.h +++ b/tests/datasets/system_tests/yolo/v2/YOLOV2ConvolutionLayerDataset.h @@ -26,7 +26,7 @@ #include "tests/datasets/ConvolutionLayerDataset.h" -#include "tests/TypePrinter.h" +#include "utils/TypePrinter.h" #include "arm_compute/core/TensorShape.h" #include "arm_compute/core/Types.h" diff --git a/tests/datasets/system_tests/yolo/v2/YOLOV2PoolingLayerDataset.h b/tests/datasets/system_tests/yolo/v2/YOLOV2PoolingLayerDataset.h index 3763d63588..62222f3a88 100644 --- a/tests/datasets/system_tests/yolo/v2/YOLOV2PoolingLayerDataset.h +++ b/tests/datasets/system_tests/yolo/v2/YOLOV2PoolingLayerDataset.h @@ -26,7 +26,7 @@ #include "tests/datasets/PoolingLayerDataset.h" -#include "tests/TypePrinter.h" +#include "utils/TypePrinter.h" #include "arm_compute/core/TensorShape.h" #include "arm_compute/core/Types.h" diff --git a/tests/validation/Validation.h b/tests/validation/Validation.h index 7d4ce57250..38cbadaa9b 100644 --- a/tests/validation/Validation.h +++ b/tests/validation/Validation.h @@ -28,10 +28,10 @@ #include "arm_compute/core/Types.h" #include "tests/IAccessor.h" #include "tests/SimpleTensor.h" -#include "tests/TypePrinter.h" #include "tests/Utils.h" #include "tests/framework/Asserts.h" #include "tests/framework/Exceptions.h" +#include "utils/TypePrinter.h" #include #include diff --git a/tests/validation_old/AssetsLibrary.cpp b/tests/validation_old/AssetsLibrary.cpp index fa8569e458..997af27a9f 100644 --- a/tests/validation_old/AssetsLibrary.cpp +++ b/tests/validation_old/AssetsLibrary.cpp @@ -24,8 +24,8 @@ #include "tests/AssetsLibrary.h" #include "arm_compute/core/ITensor.h" -#include "tests/TypePrinter.h" #include "tests/Utils.h" +#include "utils/TypePrinter.h" #include #include diff --git a/tests/validation_old/CL/FillBorder.cpp b/tests/validation_old/CL/FillBorder.cpp index ed47a1eeb3..deb40a1a5a 100644 --- a/tests/validation_old/CL/FillBorder.cpp +++ b/tests/validation_old/CL/FillBorder.cpp @@ -22,12 +22,12 @@ * SOFTWARE. */ #include "CL/CLAccessor.h" -#include "TypePrinter.h" #include "Utils.h" #include "tests/AssetsLibrary.h" #include "tests/Globals.h" #include "tests/validation_old/Datasets.h" #include "tests/validation_old/Validation.h" +#include "utils/TypePrinter.h" #include "arm_compute/core/CL/kernels/CLFillBorderKernel.h" #include "arm_compute/core/Helpers.h" diff --git a/tests/validation_old/CL/FixedPoint/FixedPoint_QS8.cpp b/tests/validation_old/CL/FixedPoint/FixedPoint_QS8.cpp index 3721fb51d7..4f7764c49b 100644 --- a/tests/validation_old/CL/FixedPoint/FixedPoint_QS8.cpp +++ b/tests/validation_old/CL/FixedPoint/FixedPoint_QS8.cpp @@ -22,13 +22,13 @@ * SOFTWARE. */ #include "CL/CLAccessor.h" -#include "TypePrinter.h" #include "Utils.h" #include "tests/AssetsLibrary.h" #include "tests/Globals.h" #include "tests/validation_old/Datasets.h" #include "tests/validation_old/Reference.h" #include "tests/validation_old/Validation.h" +#include "utils/TypePrinter.h" #include "arm_compute/core/CL/CLKernelLibrary.h" #include "arm_compute/core/CL/ICLKernel.h" diff --git a/tests/validation_old/CL/Gaussian3x3.cpp b/tests/validation_old/CL/Gaussian3x3.cpp index 27f4833289..6aa2d0349e 100644 --- a/tests/validation_old/CL/Gaussian3x3.cpp +++ b/tests/validation_old/CL/Gaussian3x3.cpp @@ -23,7 +23,6 @@ */ #include "CL/CLAccessor.h" #include "PaddingCalculator.h" -#include "TypePrinter.h" #include "Utils.h" #include "tests/AssetsLibrary.h" #include "tests/Globals.h" @@ -31,6 +30,7 @@ #include "tests/validation_old/Reference.h" #include "tests/validation_old/Validation.h" #include "tests/validation_old/ValidationUserConfiguration.h" +#include "utils/TypePrinter.h" #include "arm_compute/core/Helpers.h" #include "arm_compute/core/Types.h" diff --git a/tests/validation_old/CL/Gaussian5x5.cpp b/tests/validation_old/CL/Gaussian5x5.cpp index c187426f4c..32a33d2661 100644 --- a/tests/validation_old/CL/Gaussian5x5.cpp +++ b/tests/validation_old/CL/Gaussian5x5.cpp @@ -23,7 +23,6 @@ */ #include "CL/CLAccessor.h" #include "PaddingCalculator.h" -#include "TypePrinter.h" #include "Utils.h" #include "tests/AssetsLibrary.h" #include "tests/Globals.h" @@ -31,6 +30,7 @@ #include "tests/validation_old/Reference.h" #include "tests/validation_old/Validation.h" #include "tests/validation_old/ValidationUserConfiguration.h" +#include "utils/TypePrinter.h" #include "arm_compute/core/Helpers.h" #include "arm_compute/core/Types.h" diff --git a/tests/validation_old/CL/HarrisCorners.cpp b/tests/validation_old/CL/HarrisCorners.cpp index 2c73679058..ff39918a43 100644 --- a/tests/validation_old/CL/HarrisCorners.cpp +++ b/tests/validation_old/CL/HarrisCorners.cpp @@ -22,7 +22,6 @@ * SOFTWARE. */ #include "CL/CLAccessor.h" -#include "TypePrinter.h" #include "Utils.h" #include "tests/AssetsLibrary.h" #include "tests/Globals.h" @@ -30,6 +29,7 @@ #include "tests/validation_old/Reference.h" #include "tests/validation_old/Validation.h" #include "tests/validation_old/ValidationUserConfiguration.h" +#include "utils/TypePrinter.h" #include "arm_compute/core/Helpers.h" #include "arm_compute/core/Types.h" diff --git a/tests/validation_old/CL/IntegralImage.cpp b/tests/validation_old/CL/IntegralImage.cpp index ea15b90b2a..7db2b688d6 100644 --- a/tests/validation_old/CL/IntegralImage.cpp +++ b/tests/validation_old/CL/IntegralImage.cpp @@ -24,13 +24,13 @@ #include "CL/CLAccessor.h" #include "PaddingCalculator.h" -#include "TypePrinter.h" #include "Utils.h" #include "tests/AssetsLibrary.h" #include "tests/Globals.h" #include "tests/validation_old/Datasets.h" #include "tests/validation_old/Reference.h" #include "tests/validation_old/Validation.h" +#include "utils/TypePrinter.h" #include "arm_compute/core/Helpers.h" #include "arm_compute/core/Types.h" diff --git a/tests/validation_old/CL/MinMaxLocation.cpp b/tests/validation_old/CL/MinMaxLocation.cpp index 8824215223..06e9388abc 100644 --- a/tests/validation_old/CL/MinMaxLocation.cpp +++ b/tests/validation_old/CL/MinMaxLocation.cpp @@ -23,13 +23,13 @@ */ #include "CL/CLAccessor.h" -#include "TypePrinter.h" #include "Utils.h" #include "tests/AssetsLibrary.h" #include "tests/Globals.h" #include "tests/validation_old/Datasets.h" #include "tests/validation_old/Reference.h" #include "tests/validation_old/Validation.h" +#include "utils/TypePrinter.h" #include "arm_compute/core/Helpers.h" #include "arm_compute/core/Types.h" diff --git a/tests/validation_old/CL/PixelWiseMultiplication.cpp b/tests/validation_old/CL/PixelWiseMultiplication.cpp index f003298a23..5bc71820d0 100644 --- a/tests/validation_old/CL/PixelWiseMultiplication.cpp +++ b/tests/validation_old/CL/PixelWiseMultiplication.cpp @@ -22,12 +22,12 @@ * SOFTWARE. */ #include "CL/CLAccessor.h" -#include "TypePrinter.h" #include "tests/Globals.h" #include "tests/Utils.h" #include "tests/validation_old/Datasets.h" #include "tests/validation_old/Reference.h" #include "tests/validation_old/Validation.h" +#include "utils/TypePrinter.h" #include "arm_compute/runtime/CL/functions/CLPixelWiseMultiplication.h" diff --git a/tests/validation_old/CL/ROIPoolingLayer.cpp b/tests/validation_old/CL/ROIPoolingLayer.cpp index edd1cccf2a..ec804ccb84 100644 --- a/tests/validation_old/CL/ROIPoolingLayer.cpp +++ b/tests/validation_old/CL/ROIPoolingLayer.cpp @@ -23,7 +23,6 @@ */ #include "CL/CLAccessor.h" #include "CL/CLArrayAccessor.h" -#include "TypePrinter.h" #include "arm_compute/runtime/CL/CLArray.h" #include "arm_compute/runtime/CL/functions/CLROIPoolingLayer.h" #include "tests/Globals.h" @@ -32,6 +31,7 @@ #include "tests/validation_old/Reference.h" #include "tests/validation_old/Validation.h" #include "tests/validation_old/ValidationUserConfiguration.h" +#include "utils/TypePrinter.h" #include #include diff --git a/tests/validation_old/CL/Sobel3x3.cpp b/tests/validation_old/CL/Sobel3x3.cpp index a4c779cd5c..cb4e318736 100644 --- a/tests/validation_old/CL/Sobel3x3.cpp +++ b/tests/validation_old/CL/Sobel3x3.cpp @@ -24,7 +24,6 @@ #include "CL/CLAccessor.h" #include "PaddingCalculator.h" -#include "TypePrinter.h" #include "Utils.h" #include "tests/AssetsLibrary.h" #include "tests/Globals.h" @@ -32,6 +31,7 @@ #include "tests/validation_old/Reference.h" #include "tests/validation_old/Validation.h" #include "tests/validation_old/ValidationUserConfiguration.h" +#include "utils/TypePrinter.h" #include "arm_compute/core/Helpers.h" #include "arm_compute/core/Types.h" diff --git a/tests/validation_old/CL/Sobel5x5.cpp b/tests/validation_old/CL/Sobel5x5.cpp index 7e5dec1209..d035027218 100644 --- a/tests/validation_old/CL/Sobel5x5.cpp +++ b/tests/validation_old/CL/Sobel5x5.cpp @@ -24,7 +24,6 @@ #include "CL/CLAccessor.h" #include "PaddingCalculator.h" -#include "TypePrinter.h" #include "Utils.h" #include "tests/AssetsLibrary.h" #include "tests/Globals.h" @@ -32,6 +31,7 @@ #include "tests/validation_old/Reference.h" #include "tests/validation_old/Validation.h" #include "tests/validation_old/ValidationUserConfiguration.h" +#include "utils/TypePrinter.h" #include "arm_compute/core/Helpers.h" #include "arm_compute/core/Types.h" diff --git a/tests/validation_old/CL/Threshold.cpp b/tests/validation_old/CL/Threshold.cpp index 74ddd6873e..185790782d 100644 --- a/tests/validation_old/CL/Threshold.cpp +++ b/tests/validation_old/CL/Threshold.cpp @@ -23,7 +23,6 @@ */ #include "CL/CLAccessor.h" #include "PaddingCalculator.h" -#include "TypePrinter.h" #include "Utils.h" #include "tests/AssetsLibrary.h" #include "tests/Globals.h" @@ -31,6 +30,7 @@ #include "tests/validation_old/Reference.h" #include "tests/validation_old/Validation.h" #include "tests/validation_old/dataset/ThresholdDataset.h" +#include "utils/TypePrinter.h" #include "arm_compute/core/Helpers.h" #include "arm_compute/core/Types.h" diff --git a/tests/validation_old/CL/WarpPerspective.cpp b/tests/validation_old/CL/WarpPerspective.cpp index 6252361003..3d3da7a23e 100644 --- a/tests/validation_old/CL/WarpPerspective.cpp +++ b/tests/validation_old/CL/WarpPerspective.cpp @@ -23,7 +23,6 @@ */ #include "CL/CLAccessor.h" #include "PaddingCalculator.h" -#include "TypePrinter.h" #include "Utils.h" #include "tests/AssetsLibrary.h" #include "tests/Globals.h" @@ -32,6 +31,7 @@ #include "tests/validation_old/Reference.h" #include "tests/validation_old/Validation.h" #include "tests/validation_old/ValidationUserConfiguration.h" +#include "utils/TypePrinter.h" #include "arm_compute/core/Helpers.h" #include "arm_compute/core/Types.h" diff --git a/tests/validation_old/NEON/AbsoluteDifference.cpp b/tests/validation_old/NEON/AbsoluteDifference.cpp index aa866fff49..cde0b46268 100644 --- a/tests/validation_old/NEON/AbsoluteDifference.cpp +++ b/tests/validation_old/NEON/AbsoluteDifference.cpp @@ -23,13 +23,13 @@ */ #include "NEON/Accessor.h" #include "PaddingCalculator.h" -#include "TypePrinter.h" #include "Utils.h" #include "tests/AssetsLibrary.h" #include "tests/Globals.h" #include "tests/validation_old/Datasets.h" #include "tests/validation_old/Reference.h" #include "tests/validation_old/Validation.h" +#include "utils/TypePrinter.h" #include "arm_compute/core/Helpers.h" #include "arm_compute/core/Types.h" diff --git a/tests/validation_old/NEON/Accumulate.cpp b/tests/validation_old/NEON/Accumulate.cpp index eb680a383d..a173338542 100644 --- a/tests/validation_old/NEON/Accumulate.cpp +++ b/tests/validation_old/NEON/Accumulate.cpp @@ -23,13 +23,13 @@ */ #include "NEON/Accessor.h" #include "PaddingCalculator.h" -#include "TypePrinter.h" #include "Utils.h" #include "tests/AssetsLibrary.h" #include "tests/Globals.h" #include "tests/validation_old/Datasets.h" #include "tests/validation_old/Reference.h" #include "tests/validation_old/Validation.h" +#include "utils/TypePrinter.h" #include "arm_compute/core/Helpers.h" #include "arm_compute/core/Types.h" diff --git a/tests/validation_old/NEON/AccumulateSquared.cpp b/tests/validation_old/NEON/AccumulateSquared.cpp index 29b5edf41b..f4eea7d764 100644 --- a/tests/validation_old/NEON/AccumulateSquared.cpp +++ b/tests/validation_old/NEON/AccumulateSquared.cpp @@ -23,13 +23,13 @@ */ #include "NEON/Accessor.h" #include "PaddingCalculator.h" -#include "TypePrinter.h" #include "Utils.h" #include "tests/AssetsLibrary.h" #include "tests/Globals.h" #include "tests/validation_old/Datasets.h" #include "tests/validation_old/Reference.h" #include "tests/validation_old/Validation.h" +#include "utils/TypePrinter.h" #include "arm_compute/core/Helpers.h" #include "arm_compute/core/Types.h" diff --git a/tests/validation_old/NEON/AccumulateWeighted.cpp b/tests/validation_old/NEON/AccumulateWeighted.cpp index c59c1edbc8..758e437338 100644 --- a/tests/validation_old/NEON/AccumulateWeighted.cpp +++ b/tests/validation_old/NEON/AccumulateWeighted.cpp @@ -23,13 +23,13 @@ */ #include "NEON/Accessor.h" #include "PaddingCalculator.h" -#include "TypePrinter.h" #include "Utils.h" #include "tests/AssetsLibrary.h" #include "tests/Globals.h" #include "tests/validation_old/Datasets.h" #include "tests/validation_old/Reference.h" #include "tests/validation_old/Validation.h" +#include "utils/TypePrinter.h" #include "arm_compute/core/Helpers.h" #include "arm_compute/core/Types.h" diff --git a/tests/validation_old/NEON/FillBorder.cpp b/tests/validation_old/NEON/FillBorder.cpp index 277bbf2c0a..cbf637e7f8 100644 --- a/tests/validation_old/NEON/FillBorder.cpp +++ b/tests/validation_old/NEON/FillBorder.cpp @@ -22,12 +22,12 @@ * SOFTWARE. */ #include "NEON/Accessor.h" -#include "TypePrinter.h" #include "Utils.h" #include "tests/AssetsLibrary.h" #include "tests/Globals.h" #include "tests/validation_old/Datasets.h" #include "tests/validation_old/Validation.h" +#include "utils/TypePrinter.h" #include "arm_compute/core/Helpers.h" #include "arm_compute/core/NEON/kernels/NEFillBorderKernel.h" diff --git a/tests/validation_old/NEON/Fixedpoint/Exp_QS16.cpp b/tests/validation_old/NEON/Fixedpoint/Exp_QS16.cpp index 66115879aa..a0e785e112 100644 --- a/tests/validation_old/NEON/Fixedpoint/Exp_QS16.cpp +++ b/tests/validation_old/NEON/Fixedpoint/Exp_QS16.cpp @@ -22,13 +22,13 @@ * SOFTWARE. */ #include "NEON/Accessor.h" -#include "TypePrinter.h" #include "Utils.h" #include "tests/AssetsLibrary.h" #include "tests/Globals.h" #include "tests/validation_old/Datasets.h" #include "tests/validation_old/ReferenceCPP.h" #include "tests/validation_old/Validation.h" +#include "utils/TypePrinter.h" #include "arm_compute/core/Helpers.h" #include "arm_compute/core/NEON/NEFixedPoint.h" diff --git a/tests/validation_old/NEON/Fixedpoint/Exp_QS8.cpp b/tests/validation_old/NEON/Fixedpoint/Exp_QS8.cpp index 9e8096fa75..dbae11640a 100644 --- a/tests/validation_old/NEON/Fixedpoint/Exp_QS8.cpp +++ b/tests/validation_old/NEON/Fixedpoint/Exp_QS8.cpp @@ -22,13 +22,13 @@ * SOFTWARE. */ #include "NEON/Accessor.h" -#include "TypePrinter.h" #include "Utils.h" #include "tests/AssetsLibrary.h" #include "tests/Globals.h" #include "tests/validation_old/Datasets.h" #include "tests/validation_old/ReferenceCPP.h" #include "tests/validation_old/Validation.h" +#include "utils/TypePrinter.h" #include "arm_compute/core/Helpers.h" #include "arm_compute/core/NEON/NEFixedPoint.h" diff --git a/tests/validation_old/NEON/Fixedpoint/Invsqrt_QS16.cpp b/tests/validation_old/NEON/Fixedpoint/Invsqrt_QS16.cpp index f56707a93d..1d06e0799d 100644 --- a/tests/validation_old/NEON/Fixedpoint/Invsqrt_QS16.cpp +++ b/tests/validation_old/NEON/Fixedpoint/Invsqrt_QS16.cpp @@ -22,13 +22,13 @@ * SOFTWARE. */ #include "NEON/Accessor.h" -#include "TypePrinter.h" #include "Utils.h" #include "tests/AssetsLibrary.h" #include "tests/Globals.h" #include "tests/validation_old/Datasets.h" #include "tests/validation_old/ReferenceCPP.h" #include "tests/validation_old/Validation.h" +#include "utils/TypePrinter.h" #include "arm_compute/core/Helpers.h" #include "arm_compute/core/NEON/NEFixedPoint.h" diff --git a/tests/validation_old/NEON/Fixedpoint/Invsqrt_QS8.cpp b/tests/validation_old/NEON/Fixedpoint/Invsqrt_QS8.cpp index fb33fd4632..ea21b8f4d6 100644 --- a/tests/validation_old/NEON/Fixedpoint/Invsqrt_QS8.cpp +++ b/tests/validation_old/NEON/Fixedpoint/Invsqrt_QS8.cpp @@ -22,13 +22,13 @@ * SOFTWARE. */ #include "NEON/Accessor.h" -#include "TypePrinter.h" #include "Utils.h" #include "tests/AssetsLibrary.h" #include "tests/Globals.h" #include "tests/validation_old/Datasets.h" #include "tests/validation_old/ReferenceCPP.h" #include "tests/validation_old/Validation.h" +#include "utils/TypePrinter.h" #include "arm_compute/core/Helpers.h" #include "arm_compute/core/NEON/NEFixedPoint.h" diff --git a/tests/validation_old/NEON/Fixedpoint/Log_QS16.cpp b/tests/validation_old/NEON/Fixedpoint/Log_QS16.cpp index 6485b2031c..d85112abcc 100644 --- a/tests/validation_old/NEON/Fixedpoint/Log_QS16.cpp +++ b/tests/validation_old/NEON/Fixedpoint/Log_QS16.cpp @@ -22,13 +22,13 @@ * SOFTWARE. */ #include "NEON/Accessor.h" -#include "TypePrinter.h" #include "Utils.h" #include "tests/AssetsLibrary.h" #include "tests/Globals.h" #include "tests/validation_old/Datasets.h" #include "tests/validation_old/ReferenceCPP.h" #include "tests/validation_old/Validation.h" +#include "utils/TypePrinter.h" #include "arm_compute/core/Helpers.h" #include "arm_compute/core/NEON/NEFixedPoint.h" diff --git a/tests/validation_old/NEON/Fixedpoint/Log_QS8.cpp b/tests/validation_old/NEON/Fixedpoint/Log_QS8.cpp index 21012c52b0..41b285650a 100644 --- a/tests/validation_old/NEON/Fixedpoint/Log_QS8.cpp +++ b/tests/validation_old/NEON/Fixedpoint/Log_QS8.cpp @@ -22,13 +22,13 @@ * SOFTWARE. */ #include "NEON/Accessor.h" -#include "TypePrinter.h" #include "Utils.h" #include "tests/AssetsLibrary.h" #include "tests/Globals.h" #include "tests/validation_old/Datasets.h" #include "tests/validation_old/ReferenceCPP.h" #include "tests/validation_old/Validation.h" +#include "utils/TypePrinter.h" #include "arm_compute/core/Helpers.h" #include "arm_compute/core/NEON/NEFixedPoint.h" diff --git a/tests/validation_old/NEON/Fixedpoint/Reciprocal_QS16.cpp b/tests/validation_old/NEON/Fixedpoint/Reciprocal_QS16.cpp index 5630a3391a..9605595d80 100644 --- a/tests/validation_old/NEON/Fixedpoint/Reciprocal_QS16.cpp +++ b/tests/validation_old/NEON/Fixedpoint/Reciprocal_QS16.cpp @@ -22,13 +22,13 @@ * SOFTWARE. */ #include "NEON/Accessor.h" -#include "TypePrinter.h" #include "Utils.h" #include "tests/AssetsLibrary.h" #include "tests/Globals.h" #include "tests/validation_old/Datasets.h" #include "tests/validation_old/ReferenceCPP.h" #include "tests/validation_old/Validation.h" +#include "utils/TypePrinter.h" #include "arm_compute/core/Helpers.h" #include "arm_compute/core/NEON/NEFixedPoint.h" diff --git a/tests/validation_old/NEON/Fixedpoint/Reciprocal_QS8.cpp b/tests/validation_old/NEON/Fixedpoint/Reciprocal_QS8.cpp index 23f98acc40..7a1c5b72a7 100644 --- a/tests/validation_old/NEON/Fixedpoint/Reciprocal_QS8.cpp +++ b/tests/validation_old/NEON/Fixedpoint/Reciprocal_QS8.cpp @@ -22,13 +22,13 @@ * SOFTWARE. */ #include "NEON/Accessor.h" -#include "TypePrinter.h" #include "Utils.h" #include "tests/AssetsLibrary.h" #include "tests/Globals.h" #include "tests/validation_old/Datasets.h" #include "tests/validation_old/ReferenceCPP.h" #include "tests/validation_old/Validation.h" +#include "utils/TypePrinter.h" #include "arm_compute/core/Helpers.h" #include "arm_compute/core/NEON/NEFixedPoint.h" diff --git a/tests/validation_old/NEON/Gaussian3x3.cpp b/tests/validation_old/NEON/Gaussian3x3.cpp index becd9196ea..b1fdc5e069 100644 --- a/tests/validation_old/NEON/Gaussian3x3.cpp +++ b/tests/validation_old/NEON/Gaussian3x3.cpp @@ -23,7 +23,6 @@ */ #include "NEON/Accessor.h" #include "PaddingCalculator.h" -#include "TypePrinter.h" #include "Utils.h" #include "tests/AssetsLibrary.h" #include "tests/Globals.h" @@ -31,6 +30,7 @@ #include "tests/validation_old/Reference.h" #include "tests/validation_old/Validation.h" #include "tests/validation_old/ValidationUserConfiguration.h" +#include "utils/TypePrinter.h" #include "arm_compute/core/Helpers.h" #include "arm_compute/core/Types.h" diff --git a/tests/validation_old/NEON/Gaussian5x5.cpp b/tests/validation_old/NEON/Gaussian5x5.cpp index 240285afb6..c98d21b35c 100644 --- a/tests/validation_old/NEON/Gaussian5x5.cpp +++ b/tests/validation_old/NEON/Gaussian5x5.cpp @@ -23,7 +23,6 @@ */ #include "NEON/Accessor.h" #include "PaddingCalculator.h" -#include "TypePrinter.h" #include "Utils.h" #include "tests/AssetsLibrary.h" #include "tests/Globals.h" @@ -31,6 +30,7 @@ #include "tests/validation_old/Reference.h" #include "tests/validation_old/Validation.h" #include "tests/validation_old/ValidationUserConfiguration.h" +#include "utils/TypePrinter.h" #include "arm_compute/core/Helpers.h" #include "arm_compute/core/Types.h" diff --git a/tests/validation_old/NEON/HarrisCorners.cpp b/tests/validation_old/NEON/HarrisCorners.cpp index 809e61c053..172be87dc2 100644 --- a/tests/validation_old/NEON/HarrisCorners.cpp +++ b/tests/validation_old/NEON/HarrisCorners.cpp @@ -23,7 +23,6 @@ */ #include "NEON/Accessor.h" #include "NEON/Helper.h" -#include "TypePrinter.h" #include "Utils.h" #include "tests/AssetsLibrary.h" #include "tests/Globals.h" @@ -31,6 +30,7 @@ #include "tests/validation_old/Reference.h" #include "tests/validation_old/Validation.h" #include "tests/validation_old/ValidationUserConfiguration.h" +#include "utils/TypePrinter.h" #include "arm_compute/core/Helpers.h" #include "arm_compute/core/Types.h" diff --git a/tests/validation_old/NEON/IntegralImage.cpp b/tests/validation_old/NEON/IntegralImage.cpp index 69654b2585..f42393a745 100644 --- a/tests/validation_old/NEON/IntegralImage.cpp +++ b/tests/validation_old/NEON/IntegralImage.cpp @@ -24,13 +24,13 @@ #include "NEON/Accessor.h" #include "PaddingCalculator.h" -#include "TypePrinter.h" #include "Utils.h" #include "tests/AssetsLibrary.h" #include "tests/Globals.h" #include "tests/validation_old/Datasets.h" #include "tests/validation_old/Reference.h" #include "tests/validation_old/Validation.h" +#include "utils/TypePrinter.h" #include "arm_compute/core/Helpers.h" #include "arm_compute/core/Types.h" diff --git a/tests/validation_old/NEON/MinMaxLocation.cpp b/tests/validation_old/NEON/MinMaxLocation.cpp index c41745a636..1b258d19d6 100644 --- a/tests/validation_old/NEON/MinMaxLocation.cpp +++ b/tests/validation_old/NEON/MinMaxLocation.cpp @@ -25,13 +25,13 @@ #include "NEON/Accessor.h" #include "NEON/Helper.h" #include "PaddingCalculator.h" -#include "TypePrinter.h" #include "Utils.h" #include "tests/AssetsLibrary.h" #include "tests/Globals.h" #include "tests/validation_old/Datasets.h" #include "tests/validation_old/Reference.h" #include "tests/validation_old/Validation.h" +#include "utils/TypePrinter.h" #include "arm_compute/core/Helpers.h" #include "arm_compute/core/Types.h" diff --git a/tests/validation_old/NEON/PixelWiseMultiplication.cpp b/tests/validation_old/NEON/PixelWiseMultiplication.cpp index 60eb82ef84..f352fc4390 100644 --- a/tests/validation_old/NEON/PixelWiseMultiplication.cpp +++ b/tests/validation_old/NEON/PixelWiseMultiplication.cpp @@ -23,13 +23,13 @@ */ #include "NEON/Accessor.h" #include "PaddingCalculator.h" -#include "TypePrinter.h" #include "Utils.h" #include "tests/AssetsLibrary.h" #include "tests/Globals.h" #include "tests/validation_old/Datasets.h" #include "tests/validation_old/Reference.h" #include "tests/validation_old/Validation.h" +#include "utils/TypePrinter.h" #include "arm_compute/core/Helpers.h" #include "arm_compute/core/Types.h" diff --git a/tests/validation_old/NEON/ROIPoolingLayer.cpp b/tests/validation_old/NEON/ROIPoolingLayer.cpp index 2046beb196..a8d5637412 100644 --- a/tests/validation_old/NEON/ROIPoolingLayer.cpp +++ b/tests/validation_old/NEON/ROIPoolingLayer.cpp @@ -23,7 +23,6 @@ */ #include "NEON/Accessor.h" #include "NEON/ArrayAccessor.h" -#include "TypePrinter.h" #include "arm_compute/runtime/NEON/functions/NEROIPoolingLayer.h" #include "tests/Globals.h" #include "tests/Utils.h" @@ -31,6 +30,7 @@ #include "tests/validation_old/Reference.h" #include "tests/validation_old/Validation.h" #include "tests/validation_old/ValidationUserConfiguration.h" +#include "utils/TypePrinter.h" #include #include diff --git a/tests/validation_old/NEON/Sobel3x3.cpp b/tests/validation_old/NEON/Sobel3x3.cpp index cb249e1a58..302364048a 100644 --- a/tests/validation_old/NEON/Sobel3x3.cpp +++ b/tests/validation_old/NEON/Sobel3x3.cpp @@ -22,7 +22,6 @@ * SOFTWARE. */ #include "NEON/Accessor.h" -#include "TypePrinter.h" #include "Utils.h" #include "tests/AssetsLibrary.h" #include "tests/Globals.h" @@ -30,6 +29,7 @@ #include "tests/validation_old/Reference.h" #include "tests/validation_old/Validation.h" #include "tests/validation_old/ValidationUserConfiguration.h" +#include "utils/TypePrinter.h" #include "arm_compute/core/Helpers.h" #include "arm_compute/core/Types.h" diff --git a/tests/validation_old/NEON/Sobel5x5.cpp b/tests/validation_old/NEON/Sobel5x5.cpp index 2f26e62e83..e9835b6095 100644 --- a/tests/validation_old/NEON/Sobel5x5.cpp +++ b/tests/validation_old/NEON/Sobel5x5.cpp @@ -24,7 +24,6 @@ #include "NEON/Accessor.h" #include "PaddingCalculator.h" -#include "TypePrinter.h" #include "Utils.h" #include "tests/AssetsLibrary.h" #include "tests/Globals.h" @@ -32,6 +31,7 @@ #include "tests/validation_old/Reference.h" #include "tests/validation_old/Validation.h" #include "tests/validation_old/ValidationUserConfiguration.h" +#include "utils/TypePrinter.h" #include "arm_compute/core/Helpers.h" #include "arm_compute/core/Types.h" diff --git a/tests/validation_old/NEON/Threshold.cpp b/tests/validation_old/NEON/Threshold.cpp index d56ec5eb42..6f42f19d84 100644 --- a/tests/validation_old/NEON/Threshold.cpp +++ b/tests/validation_old/NEON/Threshold.cpp @@ -23,7 +23,6 @@ */ #include "NEON/Accessor.h" #include "PaddingCalculator.h" -#include "TypePrinter.h" #include "Utils.h" #include "tests/AssetsLibrary.h" #include "tests/Globals.h" @@ -31,6 +30,7 @@ #include "tests/validation_old/Reference.h" #include "tests/validation_old/Validation.h" #include "tests/validation_old/dataset/ThresholdDataset.h" +#include "utils/TypePrinter.h" #include "arm_compute/core/Helpers.h" #include "arm_compute/core/Types.h" diff --git a/tests/validation_old/NEON/WarpPerspective.cpp b/tests/validation_old/NEON/WarpPerspective.cpp index 5a15591261..97bda1eed8 100644 --- a/tests/validation_old/NEON/WarpPerspective.cpp +++ b/tests/validation_old/NEON/WarpPerspective.cpp @@ -23,7 +23,6 @@ */ #include "NEON/Accessor.h" #include "PaddingCalculator.h" -#include "TypePrinter.h" #include "Utils.h" #include "tests/AssetsLibrary.h" #include "tests/Globals.h" @@ -32,6 +31,7 @@ #include "tests/validation_old/Reference.h" #include "tests/validation_old/Validation.h" #include "tests/validation_old/ValidationUserConfiguration.h" +#include "utils/TypePrinter.h" #include "arm_compute/core/Helpers.h" #include "arm_compute/core/Types.h" diff --git a/tests/validation_old/ProgramOptions.cpp b/tests/validation_old/ProgramOptions.cpp index 08375b344c..96320e80f9 100644 --- a/tests/validation_old/ProgramOptions.cpp +++ b/tests/validation_old/ProgramOptions.cpp @@ -24,8 +24,8 @@ #include "ProgramOptions.h" #include "arm_compute/core/Types.h" -#include "tests/TypePrinter.h" #include "tests/TypeReader.h" +#include "utils/TypePrinter.h" #include #include diff --git a/tests/validation_old/ReferenceCPP.cpp b/tests/validation_old/ReferenceCPP.cpp index eae892af26..cca8997485 100644 --- a/tests/validation_old/ReferenceCPP.cpp +++ b/tests/validation_old/ReferenceCPP.cpp @@ -26,13 +26,13 @@ #include "TensorFactory.h" #include "TensorOperations.h" #include "TensorVisitors.h" -#include "TypePrinter.h" #include "arm_compute/core/Coordinates.h" #include "arm_compute/core/Error.h" #include "arm_compute/core/TensorInfo.h" #include "arm_compute/core/TensorShape.h" #include "arm_compute/runtime/Tensor.h" +#include "utils/TypePrinter.h" #include "tests/validation_old/boost_wrapper.h" diff --git a/tests/validation_old/UNIT/FixedPoint.cpp b/tests/validation_old/UNIT/FixedPoint.cpp index 53fef97769..6a92cfb963 100644 --- a/tests/validation_old/UNIT/FixedPoint.cpp +++ b/tests/validation_old/UNIT/FixedPoint.cpp @@ -23,11 +23,11 @@ */ #include "tests/validation_old/FixedPoint.h" -#include "TypePrinter.h" #include "Utils.h" #include "support/ToolchainSupport.h" #include "tests/validation_old/Validation.h" #include "tests/validation_old/ValidationUserConfiguration.h" +#include "utils/TypePrinter.h" #include "tests/validation_old/boost_wrapper.h" diff --git a/tests/validation_old/UNIT/TensorInfo.cpp b/tests/validation_old/UNIT/TensorInfo.cpp index 488378ac1d..ec1db42e97 100644 --- a/tests/validation_old/UNIT/TensorInfo.cpp +++ b/tests/validation_old/UNIT/TensorInfo.cpp @@ -21,8 +21,8 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#include "TypePrinter.h" #include "tests/validation_old/Validation.h" +#include "utils/TypePrinter.h" #include "arm_compute/core/TensorInfo.h" #include "arm_compute/core/Types.h" diff --git a/tests/validation_old/UNIT/TensorShape.cpp b/tests/validation_old/UNIT/TensorShape.cpp index dc75b93de4..3505b1ae05 100644 --- a/tests/validation_old/UNIT/TensorShape.cpp +++ b/tests/validation_old/UNIT/TensorShape.cpp @@ -21,8 +21,8 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#include "TypePrinter.h" #include "tests/validation_old/Validation.h" +#include "utils/TypePrinter.h" #include "arm_compute/core/TensorShape.h" diff --git a/tests/validation_old/UNIT/Utils.cpp b/tests/validation_old/UNIT/Utils.cpp index b302bf27c1..a32fe189ee 100644 --- a/tests/validation_old/UNIT/Utils.cpp +++ b/tests/validation_old/UNIT/Utils.cpp @@ -23,8 +23,8 @@ */ #include "Utils.h" -#include "TypePrinter.h" #include "tests/validation_old/Validation.h" +#include "utils/TypePrinter.h" #include "tests/validation_old/boost_wrapper.h" diff --git a/tests/validation_old/Validation.cpp b/tests/validation_old/Validation.cpp index 8f173ba962..da5e874b24 100644 --- a/tests/validation_old/Validation.cpp +++ b/tests/validation_old/Validation.cpp @@ -31,9 +31,9 @@ #include "arm_compute/runtime/Tensor.h" #include "tests/IAccessor.h" #include "tests/RawTensor.h" -#include "tests/TypePrinter.h" #include "tests/Utils.h" #include "tests/validation_old/half.h" +#include "utils/TypePrinter.h" #include #include diff --git a/tests/validation_old/dataset/ActivationLayerDataset.h b/tests/validation_old/dataset/ActivationLayerDataset.h index ead52a2961..881e19ff79 100644 --- a/tests/validation_old/dataset/ActivationLayerDataset.h +++ b/tests/validation_old/dataset/ActivationLayerDataset.h @@ -24,7 +24,7 @@ #ifndef __ARM_COMPUTE_TEST_DATASET_ACTIVATION_LAYER_DATASET_H__ #define __ARM_COMPUTE_TEST_DATASET_ACTIVATION_LAYER_DATASET_H__ -#include "TypePrinter.h" +#include "utils/TypePrinter.h" #include "arm_compute/core/TensorShape.h" #include "arm_compute/core/Types.h" diff --git a/tests/validation_old/dataset/BatchNormalizationLayerDataset.h b/tests/validation_old/dataset/BatchNormalizationLayerDataset.h index ca1e3b694c..3ad1befe33 100644 --- a/tests/validation_old/dataset/BatchNormalizationLayerDataset.h +++ b/tests/validation_old/dataset/BatchNormalizationLayerDataset.h @@ -24,7 +24,7 @@ #ifndef __ARM_COMPUTE_TEST_DATASET_BATCH_NORMALIZATION_LAYER_DATASET_H__ #define __ARM_COMPUTE_TEST_DATASET_BATCH_NORMALIZATION_LAYER_DATASET_H__ -#include "TypePrinter.h" +#include "utils/TypePrinter.h" #include "arm_compute/core/TensorShape.h" #include "arm_compute/core/Types.h" diff --git a/tests/validation_old/dataset/ConvolutionLayerDataset.h b/tests/validation_old/dataset/ConvolutionLayerDataset.h index 4fcba8d86d..e612c3ec93 100644 --- a/tests/validation_old/dataset/ConvolutionLayerDataset.h +++ b/tests/validation_old/dataset/ConvolutionLayerDataset.h @@ -24,7 +24,7 @@ #ifndef __ARM_COMPUTE_TEST_DATASET_CONVOLUTION_LAYER_DATASET_H__ #define __ARM_COMPUTE_TEST_DATASET_CONVOLUTION_LAYER_DATASET_H__ -#include "TypePrinter.h" +#include "utils/TypePrinter.h" #include "arm_compute/core/TensorShape.h" #include "tests/validation_old/dataset/GenericDataset.h" diff --git a/tests/validation_old/dataset/FullyConnectedLayerDataset.h b/tests/validation_old/dataset/FullyConnectedLayerDataset.h index 3564560788..8a8fed8f0f 100644 --- a/tests/validation_old/dataset/FullyConnectedLayerDataset.h +++ b/tests/validation_old/dataset/FullyConnectedLayerDataset.h @@ -24,7 +24,7 @@ #ifndef __ARM_COMPUTE_TEST_DATASET_FULLY_CONNECTED_LAYER_DATASET_H__ #define __ARM_COMPUTE_TEST_DATASET_FULLY_CONNECTED_LAYER_DATASET_H__ -#include "TypePrinter.h" +#include "utils/TypePrinter.h" #include "arm_compute/core/TensorShape.h" #include "tests/validation_old/dataset/GenericDataset.h" diff --git a/tests/validation_old/dataset/GEMMDataset.h b/tests/validation_old/dataset/GEMMDataset.h index 5250827340..ee2a387452 100644 --- a/tests/validation_old/dataset/GEMMDataset.h +++ b/tests/validation_old/dataset/GEMMDataset.h @@ -24,7 +24,7 @@ #ifndef __ARM_COMPUTE_TEST_DATASET_GEMM_DATASET_H__ #define __ARM_COMPUTE_TEST_DATASET_GEMM_DATASET_H__ -#include "TypePrinter.h" +#include "utils/TypePrinter.h" #include "arm_compute/core/TensorShape.h" #include "arm_compute/core/Types.h" diff --git a/tests/validation_old/dataset/NormalizationLayerDataset.h b/tests/validation_old/dataset/NormalizationLayerDataset.h index cd3c14d948..489d1e0af2 100644 --- a/tests/validation_old/dataset/NormalizationLayerDataset.h +++ b/tests/validation_old/dataset/NormalizationLayerDataset.h @@ -24,7 +24,7 @@ #ifndef __ARM_COMPUTE_TEST_DATASET_NORMALIZATION_LAYER_DATASET_H__ #define __ARM_COMPUTE_TEST_DATASET_NORMALIZATION_LAYER_DATASET_H__ -#include "TypePrinter.h" +#include "utils/TypePrinter.h" #include "arm_compute/core/TensorShape.h" #include "arm_compute/core/Types.h" diff --git a/tests/validation_old/dataset/PoolingLayerDataset.h b/tests/validation_old/dataset/PoolingLayerDataset.h index 6895ae4fae..a4e570c35e 100644 --- a/tests/validation_old/dataset/PoolingLayerDataset.h +++ b/tests/validation_old/dataset/PoolingLayerDataset.h @@ -24,7 +24,7 @@ #ifndef __ARM_COMPUTE_TEST_DATASET_POOLING_LAYER_DATASET_H__ #define __ARM_COMPUTE_TEST_DATASET_POOLING_LAYER_DATASET_H__ -#include "TypePrinter.h" +#include "utils/TypePrinter.h" #include "arm_compute/core/TensorShape.h" #include "arm_compute/core/Types.h" diff --git a/tests/validation_old/dataset/ThresholdDataset.h b/tests/validation_old/dataset/ThresholdDataset.h index 74d0b9cfbe..789ffac14a 100644 --- a/tests/validation_old/dataset/ThresholdDataset.h +++ b/tests/validation_old/dataset/ThresholdDataset.h @@ -24,7 +24,7 @@ #ifndef __ARM_COMPUTE_TEST_DATASET_THRESHOLD_DATASET_H__ #define __ARM_COMPUTE_TEST_DATASET_THRESHOLD_DATASET_H__ -#include "TypePrinter.h" +#include "utils/TypePrinter.h" #include "arm_compute/core/TensorShape.h" #include "arm_compute/core/Types.h" diff --git a/utils/GraphUtils.cpp b/utils/GraphUtils.cpp new file mode 100644 index 0000000000..d763606867 --- /dev/null +++ b/utils/GraphUtils.cpp @@ -0,0 +1,165 @@ +/* + * 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 "utils/GraphUtils.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 "arm_compute/core/Error.h" +#include "libnpy/npy.hpp" + +#include + +using namespace arm_compute::graph_utils; + +PPMWriter::PPMWriter(std::string name, unsigned int maximum) + : _name(std::move(name)), _iterator(0), _maximum(maximum) +{ +} + +bool PPMWriter::access_tensor(ITensor &tensor) +{ + std::stringstream ss; + ss << _name << _iterator << ".ppm"; + if(dynamic_cast(&tensor) != nullptr) + { + arm_compute::utils::save_to_ppm(dynamic_cast(tensor), ss.str()); + } +#ifdef ARM_COMPUTE_CL + else if(dynamic_cast(&tensor) != nullptr) + { + arm_compute::utils::save_to_ppm(dynamic_cast(tensor), ss.str()); + } +#endif /* ARM_COMPUTE_CL */ + + _iterator++; + if(_maximum == 0) + { + return true; + } + return _iterator < _maximum; +} + +DummyAccessor::DummyAccessor(unsigned int maximum) + : _iterator(0), _maximum(maximum) +{ +} + +bool DummyAccessor::access_tensor(ITensor &tensor) +{ + ARM_COMPUTE_UNUSED(tensor); + bool ret = _maximum == 0 || _iterator < _maximum; + if(_iterator == _maximum) + { + _iterator = 0; + } + else + { + _iterator++; + } + return ret; +} + +NumPyBinLoader::NumPyBinLoader(std::string filename) + : _filename(std::move(filename)) +{ +} + +bool NumPyBinLoader::access_tensor(ITensor &tensor) +{ + const TensorShape tensor_shape = tensor.info()->tensor_shape(); + std::vector shape; + + // Open file + std::ifstream stream(_filename, std::ios::in | std::ios::binary); + ARM_COMPUTE_ERROR_ON_MSG(!stream.good(), "Failed to load binary data"); + // Check magic bytes and version number + unsigned char v_major = 0; + unsigned char v_minor = 0; + npy::read_magic(stream, &v_major, &v_minor); + + // Read header + std::string header; + if(v_major == 1 && v_minor == 0) + { + header = npy::read_header_1_0(stream); + } + else if(v_major == 2 && v_minor == 0) + { + header = npy::read_header_2_0(stream); + } + else + { + ARM_COMPUTE_ERROR("Unsupported file format version"); + } + + // Parse header + bool fortran_order = false; + std::string typestr; + npy::ParseHeader(header, typestr, &fortran_order, shape); + + // Check if the typestring matches the given one + std::string expect_typestr = arm_compute::utils::get_typestring(tensor.info()->data_type()); + ARM_COMPUTE_ERROR_ON_MSG(typestr != expect_typestr, "Typestrings mismatch"); + + // Validate tensor shape + ARM_COMPUTE_ERROR_ON_MSG(shape.size() != tensor_shape.num_dimensions(), "Tensor ranks mismatch"); + if(fortran_order) + { + for(size_t i = 0; i < shape.size(); ++i) + { + ARM_COMPUTE_ERROR_ON_MSG(tensor_shape[i] != shape[i], "Tensor dimensions mismatch"); + } + } + else + { + for(size_t i = 0; i < shape.size(); ++i) + { + ARM_COMPUTE_ERROR_ON_MSG(tensor_shape[i] != shape[shape.size() - i - 1], "Tensor dimensions mismatch"); + } + } + + // Read data + if(tensor.info()->padding().empty()) + { + // If tensor has no padding read directly from stream. + stream.read(reinterpret_cast(tensor.buffer()), tensor.info()->total_size()); + } + else + { + // If tensor has padding accessing tensor elements through execution window. + Window window; + window.use_tensor_dimensions(tensor_shape); + + execute_window_loop(window, [&](const Coordinates & id) + { + stream.read(reinterpret_cast(tensor.ptr_to_element(id)), tensor.info()->element_size()); + }); + } + return true; +} diff --git a/utils/GraphUtils.h b/utils/GraphUtils.h new file mode 100644 index 0000000000..a19f7e510d --- /dev/null +++ b/utils/GraphUtils.h @@ -0,0 +1,97 @@ +/* + * 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_UTILS_H__ +#define __ARM_COMPUTE_GRAPH_UTILS_H__ + +#include "arm_compute/graph/ITensorAccessor.h" +#include "arm_compute/graph/Types.h" + +namespace arm_compute +{ +namespace graph_utils +{ +/** PPM writer class */ +class PPMWriter : public graph::ITensorAccessor +{ +public: + /** Constructor + * + * @param[in] name PPM file name + * @param[in] maximum Maximum elements to access + */ + PPMWriter(std::string name, unsigned int maximum = 1); + /** Allows instances to move constructed */ + PPMWriter(PPMWriter &&) = default; + + // Inherited methods overriden: + bool access_tensor(ITensor &tensor) override; + +private: + const std::string _name; + unsigned int _iterator; + unsigned int _maximum; +}; + +/** Dummy accessor class */ +class DummyAccessor : public graph::ITensorAccessor +{ +public: + /** Constructor + * + * @param[in] maximum Maximum elements to write + */ + DummyAccessor(unsigned int maximum = 1); + /** Allows instances to move constructed */ + DummyAccessor(DummyAccessor &&) = default; + + // Inherited methods overriden: + bool access_tensor(ITensor &tensor) override; + +private: + unsigned int _iterator; + unsigned int _maximum; +}; + +/** Numpy Binary loader class*/ +class NumPyBinLoader : public graph::ITensorAccessor +{ +public: + /** Default Constructor + * + * @param filename Binary file name + */ + NumPyBinLoader(std::string filename); + /** Allows instances to move constructed */ + NumPyBinLoader(NumPyBinLoader &&) = default; + + // Inherited methods overriden: + bool access_tensor(ITensor &tensor) override; + +private: + const std::string _filename; +}; +} // namespace graph +} // namespace arm_compute + +#endif /* __ARM_COMPUTE_GRAPH_UTILS_H__ */ diff --git a/utils/TypePrinter.h b/utils/TypePrinter.h new file mode 100644 index 0000000000..30592fff55 --- /dev/null +++ b/utils/TypePrinter.h @@ -0,0 +1,619 @@ +/* + * 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_TYPE_PRINTER_H__ +#define __ARM_COMPUTE_TEST_TYPE_PRINTER_H__ + +#include "arm_compute/core/Dimensions.h" +#include "arm_compute/core/Error.h" +#include "arm_compute/core/Types.h" + +#include +#include +#include + +namespace arm_compute +{ +/** Formatted output of the Dimensions type. */ +template +inline ::std::ostream &operator<<(::std::ostream &os, const Dimensions &dimensions) +{ + if(dimensions.num_dimensions() > 0) + { + os << dimensions[0]; + + for(unsigned int d = 1; d < dimensions.num_dimensions(); ++d) + { + os << "x" << dimensions[d]; + } + } + + return os; +} + +/** Formatted output of the NonLinearFilterFunction type. */ +inline ::std::ostream &operator<<(::std::ostream &os, const NonLinearFilterFunction &function) +{ + switch(function) + { + case NonLinearFilterFunction::MAX: + os << "MAX"; + break; + case NonLinearFilterFunction::MEDIAN: + os << "MEDIAN"; + break; + case NonLinearFilterFunction::MIN: + os << "MIN"; + break; + default: + ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); + } + + return os; +} + +inline std::string to_string(const NonLinearFilterFunction &function) +{ + std::stringstream str; + str << function; + return str.str(); +} + +/** Formatted output of the MatrixPattern type. */ +inline ::std::ostream &operator<<(::std::ostream &os, const MatrixPattern &pattern) +{ + switch(pattern) + { + case MatrixPattern::BOX: + os << "BOX"; + break; + case MatrixPattern::CROSS: + os << "CROSS"; + break; + case MatrixPattern::DISK: + os << "DISK"; + break; + case MatrixPattern::OTHER: + os << "OTHER"; + break; + default: + ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); + } + + return os; +} + +inline std::string to_string(const MatrixPattern &pattern) +{ + std::stringstream str; + str << pattern; + return str.str(); +} + +/** Formatted output of the RoundingPolicy type. */ +inline ::std::ostream &operator<<(::std::ostream &os, const RoundingPolicy &rounding_policy) +{ + switch(rounding_policy) + { + case RoundingPolicy::TO_ZERO: + os << "TO_ZERO"; + break; + case RoundingPolicy::TO_NEAREST_UP: + os << "TO_NEAREST_UP"; + break; + case RoundingPolicy::TO_NEAREST_EVEN: + os << "TO_NEAREST_EVEN"; + break; + default: + ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); + } + + return os; +} + +/** Formatted output of the WeightsInfo type. */ +inline ::std::ostream &operator<<(::std::ostream &os, const WeightsInfo &weights_info) +{ + os << weights_info.are_reshaped() << ";"; + os << weights_info.num_kernels() << ";" << weights_info.kernel_size().first << "," << weights_info.kernel_size().second; + + return os; +} + +/** Formatted output of the ROIPoolingInfo type. */ +inline ::std::ostream &operator<<(::std::ostream &os, const ROIPoolingLayerInfo &pool_info) +{ + os << pool_info.pooled_width() << "x" << pool_info.pooled_height() << "~" << pool_info.spatial_scale(); + return os; +} + +/** Formatted output of the activation function type. */ +inline ::std::ostream &operator<<(::std::ostream &os, const ActivationLayerInfo::ActivationFunction &act_function) +{ + switch(act_function) + { + case ActivationLayerInfo::ActivationFunction::ABS: + os << "ABS"; + break; + case ActivationLayerInfo::ActivationFunction::LINEAR: + os << "LINEAR"; + break; + case ActivationLayerInfo::ActivationFunction::LOGISTIC: + os << "LOGISTIC"; + break; + case ActivationLayerInfo::ActivationFunction::RELU: + os << "RELU"; + break; + case ActivationLayerInfo::ActivationFunction::BOUNDED_RELU: + os << "BOUNDED_RELU"; + break; + case ActivationLayerInfo::ActivationFunction::LEAKY_RELU: + os << "LEAKY_RELU"; + break; + case ActivationLayerInfo::ActivationFunction::SOFT_RELU: + os << "SOFT_RELU"; + break; + case ActivationLayerInfo::ActivationFunction::SQRT: + os << "SQRT"; + break; + case ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU: + os << "LU_BOUNDED_RELU"; + case ActivationLayerInfo::ActivationFunction::SQUARE: + os << "SQUARE"; + break; + case ActivationLayerInfo::ActivationFunction::TANH: + os << "TANH"; + break; + default: + ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); + } + + return os; +} + +inline std::string to_string(const arm_compute::ActivationLayerInfo &info) +{ + std::stringstream str; + str << info.activation(); + return str.str(); +} + +inline std::string to_string(const arm_compute::ActivationLayerInfo::ActivationFunction &function) +{ + std::stringstream str; + str << function; + return str.str(); +} + +/** Formatted output of the NormType type. */ +inline ::std::ostream &operator<<(::std::ostream &os, const NormType &norm_type) +{ + switch(norm_type) + { + case NormType::CROSS_MAP: + os << "CROSS_MAP"; + break; + case NormType::IN_MAP_1D: + os << "IN_MAP_1D"; + break; + case NormType::IN_MAP_2D: + os << "IN_MAP_2D"; + break; + default: + ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); + } + + return os; +} + +inline std::string to_string(const arm_compute::NormalizationLayerInfo &info) +{ + std::stringstream str; + str << info.type(); + return str.str(); +} + +/** Formatted output of the PoolingType type. */ +inline ::std::ostream &operator<<(::std::ostream &os, const PoolingType &pool_type) +{ + switch(pool_type) + { + case PoolingType::AVG: + os << "AVG"; + break; + case PoolingType::MAX: + os << "MAX"; + break; + case PoolingType::L2: + os << "L2"; + break; + default: + ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); + } + + return os; +} + +/** Formatted output of @ref PoolingLayerInfo. */ +inline ::std::ostream &operator<<(::std::ostream &os, const PoolingLayerInfo &info) +{ + os << info.pool_type(); + + return os; +} + +/** Formatted output of the DataType type. */ +inline ::std::ostream &operator<<(::std::ostream &os, const DataType &data_type) +{ + switch(data_type) + { + case DataType::UNKNOWN: + os << "UNKNOWN"; + break; + case DataType::U8: + os << "U8"; + break; + case DataType::QS8: + os << "QS8"; + break; + case DataType::S8: + os << "S8"; + break; + case DataType::U16: + os << "U16"; + break; + case DataType::S16: + os << "S16"; + break; + case DataType::QS16: + os << "QS16"; + break; + case DataType::U32: + os << "U32"; + break; + case DataType::S32: + os << "S32"; + break; + case DataType::U64: + os << "U64"; + break; + case DataType::S64: + os << "S64"; + break; + case DataType::F16: + os << "F16"; + break; + case DataType::F32: + os << "F32"; + break; + case DataType::F64: + os << "F64"; + break; + case DataType::SIZET: + os << "SIZET"; + break; + default: + ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); + } + + return os; +} + +inline std::string to_string(const arm_compute::DataType &data_type) +{ + std::stringstream str; + str << data_type; + return str.str(); +} + +/** Formatted output of the Format type. */ +inline ::std::ostream &operator<<(::std::ostream &os, const Format &format) +{ + switch(format) + { + case Format::UNKNOWN: + os << "UNKNOWN"; + break; + case Format::U8: + os << "U8"; + break; + case Format::S16: + os << "S16"; + break; + case Format::U16: + os << "U16"; + break; + case Format::S32: + os << "S32"; + break; + case Format::U32: + os << "U32"; + break; + case Format::F16: + os << "F16"; + break; + case Format::F32: + os << "F32"; + break; + case Format::UV88: + os << "UV88"; + break; + case Format::RGB888: + os << "RGB888"; + break; + case Format::RGBA8888: + os << "RGBA8888"; + break; + case Format::YUV444: + os << "YUV444"; + break; + case Format::YUYV422: + os << "YUYV422"; + break; + case Format::NV12: + os << "NV12"; + break; + case Format::NV21: + os << "NV21"; + break; + case Format::IYUV: + os << "IYUV"; + break; + case Format::UYVY422: + os << "UYVY422"; + break; + default: + ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); + } + + return os; +} + +/** Formatted output of the Channel type. */ +inline ::std::ostream &operator<<(::std::ostream &os, const Channel &channel) +{ + switch(channel) + { + case Channel::UNKNOWN: + os << "UNKNOWN"; + break; + case Channel::C0: + os << "C0"; + break; + case Channel::C1: + os << "C1"; + break; + case Channel::C2: + os << "C2"; + break; + case Channel::C3: + os << "C3"; + break; + case Channel::R: + os << "R"; + break; + case Channel::G: + os << "G"; + break; + case Channel::B: + os << "B"; + break; + case Channel::A: + os << "A"; + break; + case Channel::Y: + os << "Y"; + break; + case Channel::U: + os << "U"; + break; + case Channel::V: + os << "V"; + break; + default: + ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); + } + + return os; +} + +/** Formatted output of the BorderMode type. */ +inline ::std::ostream &operator<<(::std::ostream &os, const BorderMode &mode) +{ + switch(mode) + { + case BorderMode::UNDEFINED: + os << "UNDEFINED"; + break; + case BorderMode::CONSTANT: + os << "CONSTANT"; + break; + case BorderMode::REPLICATE: + os << "REPLICATE"; + break; + default: + ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); + } + + return os; +} + +/** Formatted output of the BorderSize type. */ +inline ::std::ostream &operator<<(::std::ostream &os, const BorderSize &border) +{ + os << border.top << "," + << border.right << "," + << border.bottom << "," + << border.left; + + return os; +} + +/** Formatted output of the InterpolationPolicy type. */ +inline ::std::ostream &operator<<(::std::ostream &os, const InterpolationPolicy &policy) +{ + switch(policy) + { + case InterpolationPolicy::NEAREST_NEIGHBOR: + os << "NEAREST_NEIGHBOR"; + break; + case InterpolationPolicy::BILINEAR: + os << "BILINEAR"; + break; + case InterpolationPolicy::AREA: + os << "AREA"; + break; + default: + ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); + } + + return os; +} + +//FIXME: Check why this doesn't work and the TensorShape overload is needed +template +inline std::string to_string(const Dimensions &dimensions) +{ + std::stringstream str; + str << dimensions; + return str.str(); +} + +/** Formatted output of the TensorShape type. */ +inline std::string to_string(const TensorShape &shape) +{ + std::stringstream str; + str << shape; + return str.str(); +} + +/** Formatted output of the Rectangle type. */ +inline ::std::ostream &operator<<(::std::ostream &os, const Rectangle &rect) +{ + os << rect.width << "x" << rect.height; + os << "+" << rect.x << "+" << rect.y; + + return os; +} + +/** Formatted output of the PadStridInfo type. */ +inline ::std::ostream &operator<<(::std::ostream &os, const PadStrideInfo &pad_stride_info) +{ + os << pad_stride_info.stride().first << "," << pad_stride_info.stride().second; + os << ";"; + os << pad_stride_info.pad().first << "," << pad_stride_info.pad().second; + + return os; +} + +inline std::string to_string(const PadStrideInfo &pad_stride_info) +{ + std::stringstream str; + str << pad_stride_info; + return str.str(); +} + +inline std::string to_string(const BorderMode &mode) +{ + std::stringstream str; + str << mode; + return str.str(); +} + +inline std::string to_string(const InterpolationPolicy &policy) +{ + std::stringstream str; + str << policy; + return str.str(); +} + +/** Formatted output of the ConversionPolicy type. */ +inline ::std::ostream &operator<<(::std::ostream &os, const ConvertPolicy &policy) +{ + switch(policy) + { + case ConvertPolicy::WRAP: + os << "WRAP"; + break; + case ConvertPolicy::SATURATE: + os << "SATURATE"; + break; + default: + ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); + } + + return os; +} + +inline std::string to_string(const ConvertPolicy &policy) +{ + std::stringstream str; + str << policy; + return str.str(); +} + +/** Formatted output of the Reduction Operations. */ +inline ::std::ostream &operator<<(::std::ostream &os, const ReductionOperation &op) +{ + switch(op) + { + case ReductionOperation::SUM_SQUARE: + os << "SUM_SQUARE"; + break; + default: + ARM_COMPUTE_ERROR("NOT_SUPPORTED!"); + } + + return os; +} + +inline std::string to_string(const ReductionOperation &op) +{ + std::stringstream str; + str << op; + return str.str(); +} + +inline std::string to_string(const NormType &type) +{ + std::stringstream str; + str << type; + return str.str(); +} + +inline std::string to_string(const PoolingType &type) +{ + std::stringstream str; + str << type; + return str.str(); +} + +inline std::string to_string(const PoolingLayerInfo &info) +{ + std::stringstream str; + str << info.pool_type(); + return str.str(); +} + +} // namespace arm_compute +#endif /* __ARM_COMPUTE_TEST_TYPE_PRINTER_H__ */ diff --git a/utils/Utils.h b/utils/Utils.h index d535124598..47a352e905 100644 --- a/utils/Utils.h +++ b/utils/Utils.h @@ -30,6 +30,7 @@ #include "arm_compute/core/Validate.h" #include "arm_compute/core/Window.h" #include "arm_compute/runtime/Tensor.h" +#include "support/ToolchainSupport.h" #ifdef ARM_COMPUTE_CL #include "arm_compute/core/CL/OpenCL.h" @@ -401,6 +402,56 @@ void load_trained_data(T &tensor, const std::string &filename) } } +/** Obtain numpy type string from DataType. + * + * @param[in] data_type Data type. + * + * @return numpy type string. + */ +inline std::string get_typestring(DataType data_type) +{ + // Check endianness + const unsigned int i = 1; + const char *c = reinterpret_cast(&i); + std::string endianness; + if(*c == 1) + { + endianness = std::string("<"); + } + else + { + endianness = std::string(">"); + } + const std::string no_endianness("|"); + + switch(data_type) + { + case DataType::U8: + return no_endianness + "u" + support::cpp11::to_string(sizeof(uint8_t)); + case DataType::S8: + return no_endianness + "i" + support::cpp11::to_string(sizeof(int8_t)); + case DataType::U16: + return endianness + "u" + support::cpp11::to_string(sizeof(uint16_t)); + case DataType::S16: + return endianness + "i" + support::cpp11::to_string(sizeof(int16_t)); + case DataType::U32: + return endianness + "u" + support::cpp11::to_string(sizeof(uint32_t)); + case DataType::S32: + return endianness + "i" + support::cpp11::to_string(sizeof(int32_t)); + case DataType::U64: + return endianness + "u" + support::cpp11::to_string(sizeof(uint64_t)); + case DataType::S64: + return endianness + "i" + support::cpp11::to_string(sizeof(int64_t)); + case DataType::F32: + return endianness + "f" + support::cpp11::to_string(sizeof(float)); + case DataType::F64: + return endianness + "f" + support::cpp11::to_string(sizeof(double)); + case DataType::SIZET: + return endianness + "u" + support::cpp11::to_string(sizeof(size_t)); + default: + ARM_COMPUTE_ERROR("NOT SUPPORTED!"); + } +} } // namespace utils } // namespace arm_compute #endif /* __UTILS_UTILS_H__*/ -- cgit v1.2.1