24 #ifndef __ARM_COMPUTE_GRAPH_LAYERS_H__ 25 #define __ARM_COMPUTE_GRAPH_LAYERS_H__ 54 : _desc(desc), _accessor(std::move(accessor))
65 TensorDescriptor _desc;
78 : _accessor(std::move(accessor))
102 : _act_info(act_info)
114 ActivationLayerInfo _act_info;
133 float epsilon = 0.001f)
134 : _mean(std::move(mean)), _var(std::move(var)), _gamma(std::move(gamma)), _beta(std::move(
beta)), _epsilon(epsilon)
146 std::move(_mean), std::move(_var), std::move(_beta), std::move(_gamma));
174 unsigned int conv_height,
179 unsigned int num_groups = 1,
182 : _conv_width(conv_width),
183 _conv_height(conv_height),
185 _conv_info(std::move(conv_info)),
186 _num_groups(num_groups),
187 _weights(std::move(weights)),
188 _bias(std::move(bias)),
189 _weights_quant_info(std::move(weights_quant_info)),
190 _out_quant_info(std::move(out_quant_info))
199 Size2D(_conv_width, _conv_height), _ofm, _conv_info, _num_groups,
201 std::move(_weights), std::move(_bias), std::move(_weights_quant_info), std::move(_out_quant_info));
205 unsigned int _conv_width;
206 unsigned int _conv_height;
208 const PadStrideInfo _conv_info;
209 unsigned int _num_groups;
230 unsigned int conv_height,
233 PadStrideInfo conv_info,
235 : _conv_width(conv_width),
236 _conv_height(conv_height),
237 _conv_info(std::move(conv_info)),
238 _weights(std::move(weights)),
239 _bias(std::move(bias)),
240 _quant_info(std::move(quant_info))
249 input,
Size2D(_conv_width, _conv_height), _conv_info,
251 std::move(_weights), std::move(_bias), std::move(_quant_info));
255 unsigned int _conv_width;
256 unsigned int _conv_height;
257 const PadStrideInfo _conv_info;
293 : _num_outputs(num_outputs), _weights(std::move(weights)), _bias(std::move(bias))
302 std::move(_weights), std::move(_bias));
306 unsigned int _num_outputs;
320 : _norm_info(norm_info)
332 NormalizationLayerInfo _norm_info;
344 : _pool_info(pool_info)
356 PoolingLayerInfo _pool_info;
394 : _mul_w(std::move(mul_w)), _add_w(std::move(add_w))
445 template <
typename... Ts>
447 : _branch_merge_method(merge_method), _sub_streams()
449 _sub_streams.push_back(arm_compute::support::cpp14::make_unique<SubStream>(std::move(sub_stream1)));
450 _sub_streams.push_back(arm_compute::support::cpp14::make_unique<SubStream>(std::move(sub_stream2)));
454 _sub_streams.push_back(arm_compute::support::cpp14::make_unique<SubStream>(std::move(sub_stream)));
456 std::move(rest_sub_streams)...);
462 template <
typename... Ts>
466 _sub_streams.push_back(arm_compute::support::cpp14::make_unique<SubStream>(std::move(sub_stream)));
472 if(_sub_streams.size() == 1 && _sub_streams.at(0) !=
nullptr)
474 nid = _sub_streams[0]->tail_node();
479 std::vector<NodeIdxPair> nodes;
480 for(
auto &ss : _sub_streams)
484 const auto tail_node = s.
graph().
node(ss->tail_node());
487 nodes.push_back({ ss->tail_node(), 0 });
496 NodeIdxPair input0 = { _sub_streams[0]->tail_node(), 0 };
497 NodeIdxPair input1 = { _sub_streams[1]->tail_node(), 0 };
505 std::vector<std::unique_ptr<SubStream>> _sub_streams;
Concatenate across depth.
DepthwiseConvolutionMethod depthwise_convolution_method_hint
Depthwise Convolution method hint.
FlattenLayer()
Construct a flatten layer.
Target target_hint
Target execution hint.
const INode * node(NodeID id) const
Get node object given its id.
NodeID create_layer(IStream &s) override
Create layer and add to the given stream.
NodeID create_layer(IStream &s) override
Create layer and add to the given stream.
static NodeID add_flatten_node(Graph &g, NodeParams params, NodeIdxPair input)
Adds a flatten layer node to the graph.
Depthwise Convolution Layer.
OutputLayer(ITensorAccessorUPtr accessor)
Construct an output layer.
ReshapeLayer(TensorShape shape)
Construct a reshape layer.
static NodeID add_softmax_node(Graph &g, NodeParams params, NodeIdxPair input, float beta=1.f)
Adds a softmax node to the graph.
#define ARM_COMPUTE_ERROR_ON(cond)
If the condition is true then an error message is printed and an exception thrown.
std::unique_ptr< ITensorAccessor > ITensorAccessorUPtr
static NodeID add_scale_layer(Graph &g, const NodeParams ¶ms, NodeIdxPair input, ITensorAccessorUPtr mul_accessor=nullptr, ITensorAccessorUPtr add_accessor=nullptr)
Adds a scale layer node to the graph This layer computes a product of the input with a scale (read fr...
SoftmaxLayer(float beta=1.0f)
Construct a softmax layer.
NodeID create_layer(IStream &s) override
Create layer and add to the given stream.
NodeID create_layer(IStream &s) override
Create layer and add to the given stream.
FullyConnectedLayer(unsigned int num_outputs, ITensorAccessorUPtr weights, ITensorAccessorUPtr bias)
Construct a fully connected layer.
NodeID create_layer(IStream &s) override
Create layer and add to the given stream.
This file contains all available output stages for GEMMLowp on OpenCL.
const std::string & name() const
Layer name accessor.
NodeID create_layer(IStream &s) override
Create layer and add to the given stream.
NodeID create_layer(IStream &s) override
Create layer and add to the given stream.
NodeID create_layer(IStream &s) override
Create layer and add to the given stream.
static NodeID add_depth_concatenate_node(Graph &g, NodeParams params, std::vector< NodeIdxPair > inputs)
Adds a depth concatenate node to the graph.
ActivationLayer(ActivationLayerInfo act_info)
Construct an activation layer.
NodeID tail_node()
Returns the tail node of the Stream.
ScaleLayer(ITensorAccessorUPtr mul_w, ITensorAccessorUPtr add_w)
Construct a scale layer.
static NodeID add_activation_node(Graph &g, NodeParams params, NodeIdxPair input, ActivationLayerInfo act_info)
Adds an activation layer node to the graph.
DepthwiseConvolutionLayer(unsigned int conv_width, unsigned int conv_height, ITensorAccessorUPtr weights, ITensorAccessorUPtr bias, PadStrideInfo conv_info, const QuantizationInfo quant_info=QuantizationInfo())
Construct a depthwise convolution layer.
static NodeID add_depthwise_convolution_node(Graph &g, NodeParams params, NodeIdxPair input, Size2D kernel_spatial_extend, PadStrideInfo conv_info, DepthwiseConvolutionMethod method=DepthwiseConvolutionMethod::DEFAULT, ITensorAccessorUPtr weights_accessor=nullptr, ITensorAccessorUPtr bias_accessor=nullptr, const QuantizationInfo quant_info=QuantizationInfo())
Adds a depth-wise convolution layer node to the graph.
static NodeID add_elementwise_node(Graph &g, NodeParams params, NodeIdxPair input0, NodeIdxPair input1, EltwiseOperation operation)
Adds an element-wise layer node to the graph.
BatchNormalizationLayer(ITensorAccessorUPtr mean, ITensorAccessorUPtr var, ITensorAccessorUPtr gamma=nullptr, ITensorAccessorUPtr beta=nullptr, float epsilon=0.001f)
Construct a batch normalization layer.
static NodeID add_fully_connected_layer(Graph &g, NodeParams params, NodeIdxPair input, unsigned int num_outputs, ITensorAccessorUPtr weights_accessor=nullptr, ITensorAccessorUPtr bias_accessor=nullptr)
Adds a fully connected layer node to the graph.
static NodeID add_convolution_node(Graph &g, NodeParams params, NodeIdxPair input, Size2D kernel_spatial_extend, unsigned int depth, PadStrideInfo conv_info, unsigned int num_groups=1, ConvolutionMethod method=ConvolutionMethod::DEFAULT, FastMathHint fast_math_hint=FastMathHint::DISABLED, ITensorAccessorUPtr weights_accessor=nullptr, ITensorAccessorUPtr bias_accessor=nullptr, const QuantizationInfo weights_quant_info=QuantizationInfo(), const QuantizationInfo out_quant_info=QuantizationInfo())
Adds a convolution layer node to the graph.
void for_each(F &&)
Base case of for_each.
static NodeID add_batch_normalization_node(Graph &g, NodeParams params, NodeIdxPair input, float epsilon, ITensorAccessorUPtr mean_accessor=nullptr, ITensorAccessorUPtr var_accessor=nullptr, ITensorAccessorUPtr beta_accessor=nullptr, ITensorAccessorUPtr gamma_accessor=nullptr)
Adds a batch normalization layer node to the graph.
FastMathHint fast_math_hint
Fast math hint.
NodeID create_layer(IStream &s) override
Create layer and add to the given stream.
BranchMergeMethod
Branch layer merging method.
static NodeID add_normalization_node(Graph &g, NodeParams params, NodeIdxPair input, NormalizationLayerInfo norm_info)
Adds a normalization layer node to the graph.
virtual Graph & graph()=0
Returns the underlying graph.
static NodeID add_reshape_node(Graph &g, NodeParams params, NodeIdxPair input, TensorShape shape)
Adds a reshape layer node to the graph.
StreamHints & hints()
Returns the stream hints that are currently used.
constexpr NodeID EmptyNodeID
Constant EdgeID specifying an equivalent of null edge.
Class for specifying the size of an image or rectangle.
NodeID create_layer(IStream &s) override
Create layer and add to the given stream.
NodeID create_layer(IStream &s) override
Create layer and add to the given stream.
static NodeID add_pooling_node(Graph &g, NodeParams params, NodeIdxPair input, PoolingLayerInfo pool_info)
Adds a pooling layer node to the graph.
Quantization settings (used for QASYMM8 data type)
Batchnormalization Layer.
static NodeID add_output_node(Graph &g, NodeParams params, NodeIdxPair input, ITensorAccessorUPtr accessor=nullptr)
Adds an output layer node to the graph.
Adds the results of each stream.
BranchLayer(SubStream &&sub_stream)
Construct a branch layer.
PoolingLayer(PoolingLayerInfo pool_info)
Construct a pooling layer.
NodeID create_layer(IStream &s) override
Create layer and add to the given stream.
BranchLayer(BranchMergeMethod merge_method, SubStream &&sub_stream1, SubStream &&sub_stream2, Ts &&...rest_sub_streams)
Construct a branch layer.
ConvolutionLayer(unsigned int conv_width, unsigned int conv_height, unsigned int ofm, ITensorAccessorUPtr weights, ITensorAccessorUPtr bias, PadStrideInfo conv_info, unsigned int num_groups=1, const QuantizationInfo weights_quant_info=QuantizationInfo(), const QuantizationInfo out_quant_info=QuantizationInfo())
Construct a convolution layer.
ConvolutionMethod convolution_method_hint
Convolution method hint.
static NodeID add_input_node(Graph &g, NodeParams params, TensorDescriptor desc, ITensorAccessorUPtr accessor=nullptr)
Adds an input layer node to the graph.
NodeID create_layer(IStream &s) override
Create layer and add to the given stream.
NormalizationLayer(NormalizationLayerInfo norm_info)
Construct a normalization layer.