aboutsummaryrefslogtreecommitdiff
path: root/arm_compute/graph2/frontend
diff options
context:
space:
mode:
Diffstat (limited to 'arm_compute/graph2/frontend')
-rw-r--r--arm_compute/graph2/frontend/ILayer.h53
-rw-r--r--arm_compute/graph2/frontend/IStream.h93
-rw-r--r--arm_compute/graph2/frontend/IStreamOperators.h90
-rw-r--r--arm_compute/graph2/frontend/Layers.h471
-rw-r--r--arm_compute/graph2/frontend/Stream.h84
-rw-r--r--arm_compute/graph2/frontend/SubStream.h75
-rw-r--r--arm_compute/graph2/frontend/Types.h69
7 files changed, 0 insertions, 935 deletions
diff --git a/arm_compute/graph2/frontend/ILayer.h b/arm_compute/graph2/frontend/ILayer.h
deleted file mode 100644
index f8f6a5d47e..0000000000
--- a/arm_compute/graph2/frontend/ILayer.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (c) 2018 ARM Limited.
- *
- * SPDX-License-Identifier: MIT
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-#ifndef __ARM_COMPUTE_GRAPH2_ILAYER_H__
-#define __ARM_COMPUTE_GRAPH2_ILAYER_H__
-
-namespace arm_compute
-{
-namespace graph2
-{
-namespace frontend
-{
-// Forward declarations
-class IStream;
-
-/** ILayer interface */
-class ILayer
-{
-public:
- /** Default destructor */
- virtual ~ILayer() = default;
- /** Create layer and add to the given stream.
- *
- * @param[in] s Stream to add layer to.
- *
- * @return ID of the created node.
- */
- virtual NodeID create_layer(IStream &s) = 0;
-};
-} // namespace frontend
-} // namespace graph2
-} // namespace arm_compute
-#endif /* __ARM_COMPUTE_GRAPH2_ILAYER_H__ */
diff --git a/arm_compute/graph2/frontend/IStream.h b/arm_compute/graph2/frontend/IStream.h
deleted file mode 100644
index 110be5230d..0000000000
--- a/arm_compute/graph2/frontend/IStream.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright (c) 2018 ARM Limited.
- *
- * SPDX-License-Identifier: MIT
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-#ifndef __ARM_COMPUTE_GRAPH2_ISTREAM_H__
-#define __ARM_COMPUTE_GRAPH2_ISTREAM_H__
-
-#include "arm_compute/graph2/frontend/Types.h"
-
-namespace arm_compute
-{
-namespace graph2
-{
-// Forward declarations
-class Graph;
-
-namespace frontend
-{
-// Forward declarations
-class ILayer;
-
-/** Stream interface **/
-class IStream
-{
-public:
- virtual ~IStream() = default;
- /** Adds a layer to the stream
- *
- * @param[in] layer Layer to add
- */
- virtual void add_layer(ILayer &layer) = 0;
- /** Returns the underlying graph
- *
- * @return Underlying graph
- */
- virtual Graph &graph() = 0;
- /** Returns the underlying graph
- *
- * @return Underlying graph
- */
- virtual const Graph &graph() const = 0;
- /** Returns the tail node of the Stream
- *
- * @return Tail Node ID
- */
- NodeID tail_node()
- {
- return _tail_node;
- }
- /** Returns the stream hints that are currently used
- *
- * @return Stream hints
- */
- StreamHints &hints()
- {
- return _hints;
- }
- /** Forwards tail of stream to a given nid
- *
- * @param[in] nid NodeID of the updated tail node
- */
- void forward_tail(NodeID nid)
- {
- _tail_node = (nid != NullTensorID) ? nid : _tail_node;
- }
-
-protected:
- StreamHints _hints = {}; /**< Execution and algorithmic hints */
- NodeID _tail_node = { EmptyNodeID }; /**< NodeID pointing to the last(tail) node of the graph */
-};
-} // namespace frontend
-} // namespace graph2
-} // namespace arm_compute
-#endif /* __ARM_COMPUTE_GRAPH2_ISTREAM_H__ */
diff --git a/arm_compute/graph2/frontend/IStreamOperators.h b/arm_compute/graph2/frontend/IStreamOperators.h
deleted file mode 100644
index 1798e4a4ab..0000000000
--- a/arm_compute/graph2/frontend/IStreamOperators.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Copyright (c) 2018 ARM Limited.
- *
- * SPDX-License-Identifier: MIT
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-#ifndef __ARM_COMPUTE_GRAPH2_ISTREAM_OPERATORS_H__
-#define __ARM_COMPUTE_GRAPH2_ISTREAM_OPERATORS_H__
-
-#include "arm_compute/graph2/frontend/IStream.h"
-#include "arm_compute/graph2/frontend/Types.h"
-
-namespace arm_compute
-{
-namespace graph2
-{
-namespace frontend
-{
-// Forward declarations
-class ILayer;
-
-/** Overloaded stream operator to add a node to the graph
- *
- * @param[in, out] s Stream to add the tensor
- * @param[in] layer Layer to be added
- *
- * @return Updated stream
- */
-inline IStream &operator<<(IStream &s, ILayer &&layer)
-{
- s.add_layer(layer);
- return s;
-}
-/** Overloaded stream operator to provide a target hint to the graph
- *
- * @param[in, out] s Stream to provide the hint to
- * @param[in] target_hint Target hint to be considered
- *
- * @return Updated stream
- */
-inline IStream &operator<<(IStream &s, Target target_hint)
-{
- s.hints().target_hint = target_hint;
- return s;
-}
-/** Overloaded stream operator to provide a convolution method hint to the graph
- *
- * @param[in, out] s Stream to provide the hint to
- * @param[in] convolution_method_hint Convolution method hint to be considered
- *
- * @return Updated stream
- */
-inline IStream &operator<<(IStream &s, ConvolutionMethod convolution_method_hint)
-{
- s.hints().convolution_method_hint = convolution_method_hint;
- return s;
-}
-/** Overloaded stream operator to provide a depthwise convolution method hint to the graph
- *
- * @param[in, out] s Stream to provide the hint to
- * @param[in] depthwise_convolution_method_hint Depthwise Convolution method hint to be considered
- *
- * @return Updated stream
- */
-inline IStream &operator<<(IStream &s, DepthwiseConvolutionMethod depthwise_convolution_method_hint)
-{
- s.hints().depthwise_convolution_method_hint = depthwise_convolution_method_hint;
- return s;
-}
-} // namespace frontend
-} // namespace graph2
-} // namespace arm_compute
-#endif /* __ARM_COMPUTE_GRAPH2_ISTREAM_OPERATORS_H__ */
diff --git a/arm_compute/graph2/frontend/Layers.h b/arm_compute/graph2/frontend/Layers.h
deleted file mode 100644
index 779b471b52..0000000000
--- a/arm_compute/graph2/frontend/Layers.h
+++ /dev/null
@@ -1,471 +0,0 @@
-/*
- * Copyright (c) 2018 ARM Limited.
- *
- * SPDX-License-Identifier: MIT
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-#ifndef __ARM_COMPUTE_GRAPH2_LAYERS_H__
-#define __ARM_COMPUTE_GRAPH2_LAYERS_H__
-
-#include "arm_compute/graph2/GraphBuilder.h"
-#include "arm_compute/graph2/Types.h"
-#include "arm_compute/graph2/frontend/ILayer.h"
-#include "arm_compute/graph2/frontend/IStream.h"
-#include "arm_compute/graph2/frontend/SubStream.h"
-
-#include "arm_compute/core/utils/misc/Utility.h"
-
-#include <memory>
-#include <string>
-
-namespace arm_compute
-{
-namespace graph2
-{
-namespace frontend
-{
-/** Input Layer */
-class InputLayer final : public ILayer
-{
-public:
- /** Construct an input layer.
- *
- * @param[in] desc Description of input tensor.
- * @param[in] accessor Accessor to get input tensor data from.
- */
- InputLayer(TensorDescriptor desc, ITensorAccessorUPtr accessor)
- : _desc(desc), _accessor(std::move(accessor))
- {
- }
-
- NodeID create_layer(IStream &s) override
- {
- NodeParams common_params = { "", s.hints().target_hint };
- return GraphBuilder::add_input_node(s.graph(), common_params, _desc, std::move(_accessor));
- }
-
-private:
- TensorDescriptor _desc;
- ITensorAccessorUPtr _accessor;
-};
-
-/** Output Layer */
-class OutputLayer final : public ILayer
-{
-public:
- /** Construct an output layer.
- *
- * @param[in] accessor Accessor to give output tensor data to.
- */
- OutputLayer(ITensorAccessorUPtr accessor)
- : _accessor(std::move(accessor))
- {
- }
-
- NodeID create_layer(IStream &s) override
- {
- NodeParams common_params = { "", s.hints().target_hint };
- NodeIdxPair input = { s.tail_node(), 0 };
- return GraphBuilder::add_output_node(s.graph(), common_params, input, std::move(_accessor));
- }
-
-private:
- ITensorAccessorUPtr _accessor;
-};
-
-/** Activation Layer */
-class ActivationLayer final : public ILayer
-{
-public:
- /** Construct an activation layer.
- *
- * @param[in] act_info Activation information
- */
- ActivationLayer(ActivationLayerInfo act_info)
- : _act_info(act_info)
- {
- }
-
- NodeID create_layer(IStream &s) override
- {
- NodeParams common_params = { "", s.hints().target_hint };
- NodeIdxPair input = { s.tail_node(), 0 };
- return GraphBuilder::add_activation_node(s.graph(), common_params, input, _act_info);
- }
-
-private:
- ActivationLayerInfo _act_info;
-};
-
-/** Batchnormalization Layer */
-class BatchNormalizationLayer final : public ILayer
-{
-public:
- /** Construct a batch normalization layer.
- *
- * @param[in] mean Accessor to get mean tensor data from.
- * @param[in] var Accessor to get var tensor data from.
- * @param[in] gamma (Optional) Accessor to get gamma tensor data from. Default: nullptr.
- * @param[in] beta (Optional) Accessor to get beta tensor data from. Default: nullptr.
- * @param[in] epsilon (Optional) Epsilon value. Default: 0.001.
- */
- BatchNormalizationLayer(ITensorAccessorUPtr mean,
- ITensorAccessorUPtr var,
- ITensorAccessorUPtr gamma = nullptr,
- ITensorAccessorUPtr beta = nullptr,
- float epsilon = 0.001f)
- : _mean(std::move(mean)), _var(std::move(var)), _gamma(std::move(gamma)), _beta(std::move(beta)), _epsilon(epsilon)
- {
- }
-
- NodeID create_layer(IStream &s) override
- {
- ARM_COMPUTE_ERROR_ON(_mean == nullptr);
- ARM_COMPUTE_ERROR_ON(_var == nullptr);
-
- NodeParams common_params = { "", s.hints().target_hint };
- NodeIdxPair input = { s.tail_node(), 0 };
- return GraphBuilder::add_batch_normalization_node(s.graph(), common_params, input, _epsilon,
- std::move(_mean), std::move(_var), std::move(_beta), std::move(_gamma));
- }
-
-private:
- ITensorAccessorUPtr _mean;
- ITensorAccessorUPtr _var;
- ITensorAccessorUPtr _gamma;
- ITensorAccessorUPtr _beta;
- float _epsilon;
-};
-
-/** Convolution Layer */
-class ConvolutionLayer final : public ILayer
-{
-public:
- /** Construct a convolution layer.
- *
- * @param[in] conv_width Convolution width.
- * @param[in] conv_height Convolution height.
- * @param[in] ofm Output feature map.
- * @param[in] weights Accessor to get kernel weights from.
- * @param[in] bias Accessor to get kernel bias from.
- * @param[in] conv_info Padding and stride information.
- * @param[in] num_groups (Optional) Number of groups. Default: 1.
- */
- ConvolutionLayer(unsigned int conv_width,
- unsigned int conv_height,
- unsigned int ofm,
- ITensorAccessorUPtr weights,
- ITensorAccessorUPtr bias,
- PadStrideInfo conv_info,
- unsigned int num_groups = 1)
- : _conv_width(conv_width),
- _conv_height(conv_height),
- _ofm(ofm),
- _conv_info(std::move(conv_info)),
- _num_groups(num_groups),
- _weights(std::move(weights)),
- _bias(std::move(bias))
- {
- }
-
- NodeID create_layer(IStream &s) override
- {
- NodeIdxPair input = { s.tail_node(), 0 };
- NodeParams common_params = { "", s.hints().target_hint };
- return GraphBuilder::add_convolution_node(s.graph(), common_params, input,
- Size2D(_conv_width, _conv_height), _ofm, _conv_info, _num_groups,
- s.hints().convolution_method_hint,
- std::move(_weights), std::move(_bias));
- }
-
-private:
- unsigned int _conv_width;
- unsigned int _conv_height;
- unsigned int _ofm;
- const PadStrideInfo _conv_info;
- unsigned int _num_groups;
- ITensorAccessorUPtr _weights;
- ITensorAccessorUPtr _bias;
-};
-
-/** Depthwise Convolution Layer */
-class DepthwiseConvolutionLayer final : public ILayer
-{
-public:
- /** Construct a depthwise convolution layer.
- *
- * @param[in] conv_width Convolution width.
- * @param[in] conv_height Convolution height.
- * @param[in] weights Accessor to get kernel weights from.
- * @param[in] bias Accessor to get kernel bias from.
- * @param[in] conv_info Padding and stride information.
- */
- DepthwiseConvolutionLayer(unsigned int conv_width,
- unsigned int conv_height,
- ITensorAccessorUPtr weights,
- ITensorAccessorUPtr bias,
- PadStrideInfo conv_info)
- : _conv_width(conv_width),
- _conv_height(conv_height),
- _conv_info(std::move(conv_info)),
- _weights(std::move(weights)),
- _bias(std::move(bias))
- {
- }
-
- NodeID create_layer(IStream &s) override
- {
- NodeIdxPair input = { s.tail_node(), 0 };
- NodeParams common_params = { "", s.hints().target_hint };
- return GraphBuilder::add_depthwise_convolution_node(s.graph(), common_params,
- input, Size2D(_conv_width, _conv_height), _conv_info,
- s.hints().depthwise_convolution_method_hint,
- std::move(_weights), std::move(_bias));
- }
-
-private:
- unsigned int _conv_width;
- unsigned int _conv_height;
- const PadStrideInfo _conv_info;
- ITensorAccessorUPtr _weights;
- ITensorAccessorUPtr _bias;
-};
-
-/** Flatten Layer */
-class FlattenLayer final : public ILayer
-{
-public:
- /** Construct a flatten layer. */
- FlattenLayer()
- {
- }
-
- NodeID create_layer(IStream &s) override
- {
- NodeParams common_params = { "", s.hints().target_hint };
- NodeIdxPair input = { s.tail_node(), 0 };
- return GraphBuilder::add_flatten_node(s.graph(), common_params, input);
- }
-};
-
-/** Fully Connected Layer */
-class FullyConnectedLayer final : public ILayer
-{
-public:
- /** Construct a fully connected layer.
- *
- * @param[in] num_outputs Number of outputs.
- * @param[in] weights Accessor to get weights from.
- * @param[in] bias Accessor to get bias from.
- */
- FullyConnectedLayer(unsigned int num_outputs,
- ITensorAccessorUPtr weights,
- ITensorAccessorUPtr bias)
- : _num_outputs(num_outputs), _weights(std::move(weights)), _bias(std::move(bias))
- {
- }
-
- NodeID create_layer(IStream &s) override
- {
- NodeParams common_params = { "", s.hints().target_hint };
- NodeIdxPair input = { s.tail_node(), 0 };
- return GraphBuilder::add_fully_connected_layer(s.graph(), common_params, input, _num_outputs,
- std::move(_weights), std::move(_bias));
- }
-
-private:
- unsigned int _num_outputs;
- ITensorAccessorUPtr _weights;
- ITensorAccessorUPtr _bias;
-};
-
-/** Normalization Layer */
-class NormalizationLayer final : public ILayer
-{
-public:
- /** Construct a normalization layer.
- *
- * @param[in] norm_info Normalization information.
- */
- NormalizationLayer(NormalizationLayerInfo norm_info)
- : _norm_info(norm_info)
- {
- }
-
- NodeID create_layer(IStream &s) override
- {
- NodeParams common_params = { "", s.hints().target_hint };
- NodeIdxPair input = { s.tail_node(), 0 };
- return GraphBuilder::add_normalization_node(s.graph(), common_params, input, _norm_info);
- }
-
-private:
- NormalizationLayerInfo _norm_info;
-};
-
-/** Pooling Layer */
-class PoolingLayer final : public ILayer
-{
-public:
- /** Construct a pooling layer.
- *
- * @param[in] pool_info Pooling information.
- */
- PoolingLayer(PoolingLayerInfo pool_info)
- : _pool_info(pool_info)
- {
- }
-
- NodeID create_layer(IStream &s) override
- {
- NodeParams common_params = { "", s.hints().target_hint };
- NodeIdxPair input = { s.tail_node(), 0 };
- return GraphBuilder::add_pooling_node(s.graph(), common_params, input, _pool_info);
- }
-
-private:
- PoolingLayerInfo _pool_info;
-};
-
-/** Reshape Layer */
-class ReshapeLayer final : public ILayer
-{
-public:
- /** Construct a reshape layer.
- *
- * @param[in] shape Target shape.
- */
- ReshapeLayer(TensorShape shape)
- : _shape(shape)
- {
- }
-
- NodeID create_layer(IStream &s) override
- {
- NodeParams common_params = { "", s.hints().target_hint };
- NodeIdxPair input = { s.tail_node(), 0 };
- return GraphBuilder::add_reshape_node(s.graph(), common_params, input, _shape);
- }
-
-private:
- TensorShape _shape;
-};
-
-/** Softmax Layer */
-class SoftmaxLayer final : public ILayer
-{
-public:
- /** Construct a softmax layer.
- *
- * @param[in] beta (Optional) Beta value. Default 1.0.
- */
- SoftmaxLayer(float beta = 1.0f)
- : _beta(beta)
- {
- }
-
- NodeID create_layer(IStream &s) override
- {
- NodeParams common_params = { "", s.hints().target_hint };
- NodeIdxPair input = { s.tail_node(), 0 };
- return GraphBuilder::add_softmax_node(s.graph(), common_params, input, _beta);
- }
-
-private:
- float _beta;
-};
-
-/** Branch Layer */
-class BranchLayer final : public ILayer
-{
-public:
- /** Construct a branch layer
- *
- * @param[in] merge_method Branch merging method
- * @param[in] sub_stream1 First graph branch
- * @param[in] sub_stream2 Second graph branch
- * @param[in] rest_sub_streams Rest sub-graph branches
- */
- template <typename... Ts>
- BranchLayer(BranchMergeMethod merge_method, SubStream &&sub_stream1, SubStream &&sub_stream2, Ts &&... rest_sub_streams)
- : _branch_merge_method(merge_method), _sub_streams()
- {
- _sub_streams.push_back(arm_compute::support::cpp14::make_unique<SubStream>(std::move(sub_stream1)));
- _sub_streams.push_back(arm_compute::support::cpp14::make_unique<SubStream>(std::move(sub_stream2)));
-
- utility::for_each([&](SubStream && sub_stream)
- {
- _sub_streams.push_back(arm_compute::support::cpp14::make_unique<SubStream>(std::move(sub_stream)));
- },
- std::move(rest_sub_streams)...);
- }
- /** Construct a branch layer
- *
- * @param[in] sub_stream Sub-stream
- */
- template <typename... Ts>
- BranchLayer(SubStream &&sub_stream)
- : _branch_merge_method(BranchMergeMethod::DEPTH_CONCATENATE), _sub_streams()
- {
- _sub_streams.push_back(arm_compute::support::cpp14::make_unique<SubStream>(std::move(sub_stream)));
- }
- NodeID create_layer(IStream &s) override
- {
- NodeID nid = EmptyNodeID;
- NodeParams common_params = { "", s.hints().target_hint };
- if(_sub_streams.size() == 1 && _sub_streams.at(0) != nullptr)
- {
- nid = _sub_streams[0]->tail_node();
- }
- else if(_branch_merge_method == BranchMergeMethod::DEPTH_CONCATENATE)
- {
- // Collect tail nodes and perform DepthConcatenate
- std::vector<NodeIdxPair> nodes;
- for(auto &ss : _sub_streams)
- {
- if(ss && (ss->tail_node() != EmptyNodeID))
- {
- const auto tail_node = s.graph().node(ss->tail_node());
- if(tail_node != nullptr && tail_node->type() != NodeType::Output)
- {
- nodes.push_back({ ss->tail_node(), 0 });
- }
- }
- }
- nid = GraphBuilder::add_depth_concatenate_node(s.graph(), common_params, nodes);
- }
- else
- {
- ARM_COMPUTE_ERROR_ON(_sub_streams.size() != 2);
- NodeIdxPair input0 = { _sub_streams[0]->tail_node(), 0 };
- NodeIdxPair input1 = { _sub_streams[1]->tail_node(), 0 };
- nid = GraphBuilder::add_elementwise_node(s.graph(), common_params, input0, input1, EltwiseOperation::ADD);
- }
- return nid;
- }
-
-private:
- BranchMergeMethod _branch_merge_method;
- std::vector<std::unique_ptr<SubStream>> _sub_streams;
-};
-} // namespace frontend
-} // namespace graph2
-} // namespace arm_compute
-#endif /* __ARM_COMPUTE_GRAPH2_LAYERS_H__ */
diff --git a/arm_compute/graph2/frontend/Stream.h b/arm_compute/graph2/frontend/Stream.h
deleted file mode 100644
index bfefe12225..0000000000
--- a/arm_compute/graph2/frontend/Stream.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Copyright (c) 2018 ARM Limited.
- *
- * SPDX-License-Identifier: MIT
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-#ifndef __ARM_COMPUTE_GRAPH2_STREAM_H__
-#define __ARM_COMPUTE_GRAPH2_STREAM_H__
-
-#include "arm_compute/graph2/frontend/IStream.h"
-#include "arm_compute/graph2/frontend/IStreamOperators.h"
-#include "arm_compute/graph2/frontend/Types.h"
-
-#include "arm_compute/graph2/Graph.h"
-#include "arm_compute/graph2/GraphContext.h"
-#include "arm_compute/graph2/GraphManager.h"
-
-namespace arm_compute
-{
-namespace graph2
-{
-namespace frontend
-{
-// Forward Declarations
-class ILayer;
-
-/** Stream frontend class to construct simple graphs in a stream fashion */
-class Stream final : public IStream
-{
-public:
- /** Constructor
- *
- * @param[in] id Stream id
- * @param[in] name Stream name
- */
- Stream(size_t id, std::string name);
- /** Prevent instances of this class from being copied (As this class contains pointers) */
- Stream(const Stream &) = delete;
- /** Default move constructor */
- Stream(Stream &&) = default;
- /** Prevent instances of this class from being copied (As this class contains pointers) */
- Stream &operator=(const Stream &) = delete;
- /** Default move assignment operator */
- Stream &operator=(Stream &&) = default;
- /** Finalizes the stream for an execution target
- *
- * @param[in] target Execution target
- * @param[in] config (Optional) Graph configuration to use
- */
- void finalize(Target target, const GraphConfig &config);
- /** Executes the stream **/
- void run();
-
- // Inherited overridden methods
- void add_layer(ILayer &layer) override;
- Graph &graph() override;
- const Graph &graph() const override;
-
-private:
- GraphManager _manager; /**< Graph manager */
- GraphContext _ctx; /**< Graph context to use */
- Graph _g; /**< Internal graph representation of the stream */
-};
-} // namespace frontend
-} // namespace graph2
-} // namespace arm_compute
-#endif /* __ARM_COMPUTE_GRAPH2_STREAM_H__ */ \ No newline at end of file
diff --git a/arm_compute/graph2/frontend/SubStream.h b/arm_compute/graph2/frontend/SubStream.h
deleted file mode 100644
index dee09b76ea..0000000000
--- a/arm_compute/graph2/frontend/SubStream.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright (c) 2018 ARM Limited.
- *
- * SPDX-License-Identifier: MIT
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-#ifndef __ARM_COMPUTE_GRAPH2_SUB_STREAM_H__
-#define __ARM_COMPUTE_GRAPH2_SUB_STREAM_H__
-
-#include "arm_compute/graph2/frontend/IStream.h"
-#include "arm_compute/graph2/frontend/IStreamOperators.h"
-#include "arm_compute/graph2/frontend/Types.h"
-
-#include <memory>
-#include <vector>
-
-namespace arm_compute
-{
-namespace graph2
-{
-// Forward declarations
-class Graph;
-
-namespace frontend
-{
-// Forward declarations
-class ILayer;
-
-/** Sub stream class*/
-class SubStream final : public IStream
-{
-public:
- /** Default Constructor
- *
- * @param[in] s Parent stream
- */
- SubStream(IStream &s);
- /** Prevent instances of this class from being copied (As this class contains pointers) */
- SubStream(const SubStream &) = delete;
- /** Default move constructor */
- SubStream(SubStream &&) = default;
- /** Prevent instances of this class from being copied (As this class contains pointers) */
- SubStream &operator=(const SubStream &) = delete;
- /** Default move assignment operator */
- SubStream &operator=(SubStream &&) = default;
-
- // Inherited overridden methods
- void add_layer(ILayer &layer) override;
- Graph &graph() override;
- const Graph &graph() const override;
-
-private:
- IStream &_s; /**< Parent stream (assume that the lifetime of the parent is longer) */
-};
-} // namespace frontend
-} // namespace graph2
-} // namespace arm_compute
-#endif /* __ARM_COMPUTE_GRAPH2_SUB_STREAM_H__ */
diff --git a/arm_compute/graph2/frontend/Types.h b/arm_compute/graph2/frontend/Types.h
deleted file mode 100644
index d433d1547b..0000000000
--- a/arm_compute/graph2/frontend/Types.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright (c) 2018 ARM Limited.
- *
- * SPDX-License-Identifier: MIT
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-#ifndef __ARM_COMPUTE_GRAPH2_STREAM_TYPES_H__
-#define __ARM_COMPUTE_GRAPH2_STREAM_TYPES_H__
-
-#include "arm_compute/graph2/Types.h"
-
-namespace arm_compute
-{
-namespace graph2
-{
-namespace frontend
-{
-// Import types for graph
-using graph2::DataType;
-using graph2::TensorShape;
-
-using graph2::ActivationLayerInfo;
-using graph2::NormalizationLayerInfo;
-using graph2::NormType;
-using graph2::PadStrideInfo;
-using graph2::PoolingLayerInfo;
-using graph2::PoolingType;
-using graph2::Target;
-using graph2::ConvolutionMethod;
-using graph2::DepthwiseConvolutionMethod;
-using graph2::TensorDescriptor;
-using graph2::DimensionRoundingType;
-using graph2::GraphConfig;
-
-/** Branch layer merging method */
-enum class BranchMergeMethod
-{
- DEPTH_CONCATENATE, /**< Concatenate across depth */
- ADD /**< Adds the results of each stream */
-};
-
-/** Hints that can be passed to the stream to expose parameterization */
-struct StreamHints
-{
- Target target_hint = { Target::UNSPECIFIED }; /**< Target execution hint */
- ConvolutionMethod convolution_method_hint = { ConvolutionMethod::DEFAULT }; /**< Convolution method hint */
- DepthwiseConvolutionMethod depthwise_convolution_method_hint = { DepthwiseConvolutionMethod::DEFAULT }; /**< Depthwise Convolution method hint */
-};
-} // namespace frontend
-} // namespace graph2
-} // namespace arm_compute
-#endif /* __ARM_COMPUTE_GRAPH2_STREAM_TYPES_H__ */ \ No newline at end of file