arm_compute v19.05
diff --git a/arm_compute/graph/Graph.h b/arm_compute/graph/Graph.h
index 2a77682..878976f 100644
--- a/arm_compute/graph/Graph.h
+++ b/arm_compute/graph/Graph.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018 ARM Limited.
+ * Copyright (c) 2018-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -216,7 +216,7 @@
*
* @return Tensor ID
*/
- TensorID create_tensor(TensorDescriptor desc = TensorDescriptor());
+ TensorID create_tensor(const TensorDescriptor &desc = TensorDescriptor());
private:
GraphID _id = GraphID(0); /**< Graph id */
diff --git a/arm_compute/graph/GraphBuilder.h b/arm_compute/graph/GraphBuilder.h
index 1296f56..1d6ecc8 100644
--- a/arm_compute/graph/GraphBuilder.h
+++ b/arm_compute/graph/GraphBuilder.h
@@ -25,6 +25,7 @@
#define __ARM_COMPUTE_GRAPH_GRAPH_BUILDER_H__
#include "arm_compute/graph/ITensorAccessor.h"
+#include "arm_compute/graph/LayerDescriptors.h"
#include "arm_compute/graph/Types.h"
namespace arm_compute
@@ -50,7 +51,7 @@
*
* @return Node ID of the created node, EmptyNodeID in case of error
*/
- static NodeID add_const_node(Graph &g, NodeParams params, TensorDescriptor desc, ITensorAccessorUPtr accessor = nullptr);
+ static NodeID add_const_node(Graph &g, NodeParams params, const TensorDescriptor &desc, ITensorAccessorUPtr accessor = nullptr);
/** Adds an input layer node to the graph
*
* @param[in] g Graph to add the node to
@@ -60,7 +61,7 @@
*
* @return Node ID of the created node, EmptyNodeID in case of error
*/
- static NodeID add_input_node(Graph &g, NodeParams params, TensorDescriptor desc, ITensorAccessorUPtr accessor = nullptr);
+ static NodeID add_input_node(Graph &g, NodeParams params, const TensorDescriptor &desc, ITensorAccessorUPtr accessor = nullptr);
/** Adds an output layer node to the graph
*
* @param[in] g Graph to add the node to
@@ -73,14 +74,16 @@
static NodeID add_output_node(Graph &g, NodeParams params, NodeIdxPair input, ITensorAccessorUPtr accessor = nullptr);
/** Adds an activation layer node to the graph
*
- * @param[in] g Graph to add the node to
- * @param[in] params Common node parameters
- * @param[in] input Input to the activation layer node as a NodeID-Index pair
- * @param[in] act_info Activation layer information
+ * @param[in] g Graph to add the node to
+ * @param[in] params Common node parameters
+ * @param[in] input Input to the activation layer node as a NodeID-Index pair
+ * @param[in] act_info Activation layer information
+ * @param[in] out_quant_info (Optional) Output quantization info
*
* @return Node ID of the created node, EmptyNodeID in case of error
*/
- static NodeID add_activation_node(Graph &g, NodeParams params, NodeIdxPair input, ActivationLayerInfo act_info);
+ static NodeID add_activation_node(Graph &g, NodeParams params, NodeIdxPair input, ActivationLayerInfo act_info,
+ const QuantizationInfo out_quant_info = QuantizationInfo());
/** Adds a batch normalization layer node to the graph
*
* @param[in] g Graph to add the node to
@@ -163,14 +166,14 @@
ITensorAccessorUPtr weights_accessor = nullptr, ITensorAccessorUPtr bias_accessor = nullptr);
/** Adds a depth concatenate node to the graph
*
- * @param[in] g Graph to add the node to
- * @param[in] params Common node parameters
- * @param[in] inputs Inputs to the depth concatenate layer node as a NodeID-Index pair
- * @param[in] axis Concatenation axis
+ * @param[in] g Graph to add the node to
+ * @param[in] params Common node parameters
+ * @param[in] inputs Inputs to the concatenate layer node as a NodeID-Index pair
+ * @param[in] concat_descriptor Concatenation layer descriptor
*
* @return Node ID of the created node, EmptyNodeID in case of error
*/
- static NodeID add_concatenate_node(Graph &g, NodeParams params, std::vector<NodeIdxPair> inputs, DataLayoutDimension axis);
+ static NodeID add_concatenate_node(Graph &g, NodeParams params, const std::vector<NodeIdxPair> &inputs, descriptors::ConcatLayerDescriptor concat_descriptor);
/** Adds a depth-wise convolution layer node to the graph
*
* @param[in] g Graph to add the node to
@@ -183,13 +186,15 @@
* @param[in] weights_accessor (Optional) Accessor of the weights node data
* @param[in] bias_accessor (Optional) Accessor of the bias node data
* @param[in] quant_info (Optional) Weights quantization info
+ * @param[in] out_quant_info (Optional) Output quantization info
*
* @return Node ID of the created node, EmptyNodeID in case of error
*/
static NodeID add_depthwise_convolution_node(Graph &g, NodeParams params, NodeIdxPair input,
Size2D kernel_spatial_extend, PadStrideInfo conv_info, int depth_multiplier = 1,
DepthwiseConvolutionMethod method = DepthwiseConvolutionMethod::Default,
- ITensorAccessorUPtr weights_accessor = nullptr, ITensorAccessorUPtr bias_accessor = nullptr, const QuantizationInfo quant_info = QuantizationInfo());
+ ITensorAccessorUPtr weights_accessor = nullptr, ITensorAccessorUPtr bias_accessor = nullptr, const QuantizationInfo quant_info = QuantizationInfo(),
+ const QuantizationInfo out_quant_info = QuantizationInfo());
/** Adds an element-wise layer node to the graph
*
* @param[in] g Graph to add the node to
@@ -212,7 +217,7 @@
*
* @return Node ID of the created node, EmptyNodeID in case of error
*/
- static NodeID add_detection_output_node(Graph &g, NodeParams params, NodeIdxPair input_loc, NodeIdxPair input_conf, NodeIdxPair input_priorbox, DetectionOutputLayerInfo detect_info);
+ static NodeID add_detection_output_node(Graph &g, NodeParams params, NodeIdxPair input_loc, NodeIdxPair input_conf, NodeIdxPair input_priorbox, const DetectionOutputLayerInfo &detect_info);
/** Adds a Dummy node to the graph
*
* @note this node if for debugging purposes. Just alters the shape of the graph pipeline as requested.
@@ -236,6 +241,23 @@
static NodeID add_flatten_node(Graph &g, NodeParams params, NodeIdxPair input);
/** Adds a fully connected layer node to the graph
*
+ * @param[in] g Graph to add the layer to
+ * @param[in] params Common node parameters
+ * @param[in] input Input to the fully connected layer node as a NodeID-Index pair
+ * @param[in] num_outputs Number of output neurons
+ * @param[in] weights_nid Node ID of the weights node data
+ * @param[in] bias_nid (Optional) Node ID of the bias node data. Defaults to EmptyNodeID
+ * @param[in] fc_info (Optional) Fully connected layer metadata
+ * @param[in] out_quant_info (Optional) Output quantization info
+ *
+ * @return Node ID of the created node, EmptyNodeID in case of error
+ */
+ static NodeID add_fully_connected_layer(Graph &g, NodeParams params, NodeIdxPair input, unsigned int num_outputs,
+ NodeID weights_nid, NodeID bias_nid = EmptyNodeID,
+ const FullyConnectedLayerInfo fc_info = FullyConnectedLayerInfo(),
+ const QuantizationInfo out_quant_info = QuantizationInfo());
+ /** Adds a fully connected layer node to the graph
+ *
* @param[in] g Graph to add the layer to
* @param[in] params Common node parameters
* @param[in] input Input to the fully connected layer node as a NodeID-Index pair
@@ -331,7 +353,7 @@
*
* @return Node ID of the created node, EmptyNodeID in case of error
*/
- static NodeID add_priorbox_node(Graph &g, NodeParams params, NodeIdxPair input0, NodeIdxPair input1, PriorBoxLayerInfo prior_info);
+ static NodeID add_priorbox_node(Graph &g, NodeParams params, NodeIdxPair input0, NodeIdxPair input1, const PriorBoxLayerInfo &prior_info);
/** Adds a reorg layer node to the graph
*
* @param[in] g Graph to add the node to
@@ -421,6 +443,16 @@
* @return Node ID of the created node, EmptyNodeID in case of error
*/
static NodeID add_split_node(Graph &g, NodeParams params, NodeIdxPair input, unsigned int num_splits, unsigned int axis = 0);
+ /** Adds a stack layer node to the graph
+ *
+ * @param[in] g Graph to add the node to
+ * @param[in] params Common node parameters
+ * @param[in] inputs Inputs to the reorg layer node as a NodeID-Index pair
+ * @param[in] axis Axis along which the input tensors have to be packed
+ *
+ * @return Node ID of the created node, EmptyNodeID in case of error
+ */
+ static NodeID add_stack_node(Graph &g, NodeParams params, const std::vector<NodeIdxPair> &inputs, int axis);
/** Adds an upsample layer to the graph
*
* @param[in] g Graph to add the node to
diff --git a/arm_compute/graph/INode.h b/arm_compute/graph/INode.h
index 4219150..edff837 100644
--- a/arm_compute/graph/INode.h
+++ b/arm_compute/graph/INode.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018 ARM Limited.
+ * Copyright (c) 2018-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -25,6 +25,7 @@
#define __ARM_COMPUTE_GRAPH_INODE_H__
#include "arm_compute/core/Error.h"
+#include "arm_compute/graph/LayerDescriptors.h"
#include "arm_compute/graph/TensorDescriptor.h"
#include "arm_compute/graph/Types.h"
diff --git a/arm_compute/graph/INodeVisitor.h b/arm_compute/graph/INodeVisitor.h
index 573d642..291fe7c 100644
--- a/arm_compute/graph/INodeVisitor.h
+++ b/arm_compute/graph/INodeVisitor.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018 ARM Limited.
+ * Copyright (c) 2018-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -91,6 +91,11 @@
* @param[in] n Node to visit.
*/
virtual void visit(FullyConnectedLayerNode &n) = 0;
+ /** Visit FusedConvolutionBatchNormalizationNode.
+ *
+ * @param[in] n Node to visit.
+ */
+ virtual void visit(FusedConvolutionBatchNormalizationNode &n) = 0;
/** Visit InputNode.
*
* @param[in] n Node to visit.
@@ -136,6 +141,11 @@
* @param[in] n Node to visit.
*/
virtual void visit(SplitLayerNode &n) = 0;
+ /** Visit StackLayerNode.
+ *
+ * @param[in] n Node to visit.
+ */
+ virtual void visit(StackLayerNode &n) = 0;
};
/** Default visitor implementation
@@ -195,6 +205,10 @@
{
default_visit();
}
+ virtual void visit(FusedConvolutionBatchNormalizationNode &n) override
+ {
+ default_visit();
+ }
virtual void visit(InputNode &n) override
{
default_visit();
@@ -231,6 +245,10 @@
{
default_visit();
}
+ virtual void visit(StackLayerNode &n) override
+ {
+ default_visit();
+ }
#endif /* DOXYGEN_SKIP_THIS */
/** Function to be overloaded by the client and implement default behavior for the
diff --git a/arm_compute/graph/LayerDescriptors.h b/arm_compute/graph/LayerDescriptors.h
new file mode 100644
index 0000000..f52beab
--- /dev/null
+++ b/arm_compute/graph/LayerDescriptors.h
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2019 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_CONCAT_DESCRIPTOR_H__
+#define __ARM_COMPUTE_CONCAT_DESCRIPTOR_H__
+
+#include "arm_compute/core/Types.h"
+
+namespace arm_compute
+{
+namespace graph
+{
+namespace descriptors
+{
+/** Concatenate layer descriptor */
+struct ConcatLayerDescriptor
+{
+ /** Default constructor */
+ ConcatLayerDescriptor()
+ : axis(DataLayoutDimension::CHANNEL), output_qinfo()
+ {
+ }
+
+ /** Constructor concatenate layer descriptor
+ *
+ * @param[in] axis Axis.
+ */
+ ConcatLayerDescriptor(DataLayoutDimension axis)
+ : axis(axis), output_qinfo()
+ {
+ }
+
+ /** Constructor concatenate layer descriptor
+ *
+ * @param[in] axis Axis.
+ * @param[in] output_qinfo Output quantization info.
+ */
+ ConcatLayerDescriptor(DataLayoutDimension axis, QuantizationInfo output_qinfo)
+ : axis(axis), output_qinfo(output_qinfo)
+ {
+ }
+
+ const DataLayoutDimension axis; /**< Concatenation Axis */
+ const QuantizationInfo output_qinfo; /**< Output quantizazion info */
+};
+} // namespace descriptor
+} // namespace graph
+} // namespace arm_compute
+#endif /* __ARM_COMPUTE_CONCAT_DESCRIPTOR_H__ */
\ No newline at end of file
diff --git a/arm_compute/graph/Tensor.h b/arm_compute/graph/Tensor.h
index 54fb258..07eec1e 100644
--- a/arm_compute/graph/Tensor.h
+++ b/arm_compute/graph/Tensor.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018 ARM Limited.
+ * Copyright (c) 2018-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -108,7 +108,7 @@
*
* @return Bound edges
*/
- const std::set<EdgeID> bound_edges() const;
+ std::set<EdgeID> bound_edges() const;
private:
TensorID _id; /**< Tensor id */
diff --git a/arm_compute/graph/TypeLoader.h b/arm_compute/graph/TypeLoader.h
index 77f0961..41f382a 100644
--- a/arm_compute/graph/TypeLoader.h
+++ b/arm_compute/graph/TypeLoader.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018 ARM Limited.
+ * Copyright (c) 2018-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -100,6 +100,53 @@
target = target_from_name(value);
return stream;
}
+
+/** Converts a string to a strong types enumeration @ref ConvolutionMethod
+ *
+ * @param[in] name String to convert
+ *
+ * @return Converted Target enumeration
+ */
+ConvolutionMethod Convolution_method_from_name(const std::string &name);
+
+/** Input Stream operator for @ref ConvolutionMethod
+ *
+ * @param[in] stream Stream to parse
+ * @param[out] target Output target
+ *
+ * @return Updated stream
+ */
+inline ::std::istream &operator>>(::std::istream &stream, ConvolutionMethod &target)
+{
+ std::string value;
+ stream >> value;
+ target = Convolution_method_from_name(value);
+ return stream;
+}
+
+/** Converts a string to a strong types enumeration @ref DepthwiseConvolutionMethod
+ *
+ * @param[in] name String to convert
+ *
+ * @return Converted Target enumeration
+ */
+DepthwiseConvolutionMethod depthwise_convolution_method_from_name(const std::string &name);
+
+/** Input Stream operator for @ref DepthwiseConvolutionMethod
+ *
+ * @param[in] stream Stream to parse
+ * @param[out] target Output target
+ *
+ * @return Updated stream
+ */
+inline ::std::istream &operator>>(::std::istream &stream, DepthwiseConvolutionMethod &target)
+{
+ std::string value;
+ stream >> value;
+ target = depthwise_convolution_method_from_name(value);
+ return stream;
+}
+
} // namespace graph
} // namespace arm_compute
#endif /* __ARM_COMPUTE_GRAPH_TYPE_LOADER_H__ */
diff --git a/arm_compute/graph/TypePrinter.h b/arm_compute/graph/TypePrinter.h
index ca62d4e..29a2981 100644
--- a/arm_compute/graph/TypePrinter.h
+++ b/arm_compute/graph/TypePrinter.h
@@ -98,6 +98,9 @@
case NodeType::FullyConnectedLayer:
os << "FullyConnectedLayer";
break;
+ case NodeType::FusedConvolutionBatchNormalizationLayer:
+ os << "FusedConvolutionBatchNormalizationLayer";
+ break;
case NodeType::GenerateProposalsLayer:
os << "GenerateProposalsLayer";
break;
@@ -140,6 +143,9 @@
case NodeType::SplitLayer:
os << "SplitLayer";
break;
+ case NodeType::StackLayer:
+ os << "StackLayer";
+ break;
case NodeType::UpsampleLayer:
os << "UpsampleLayer";
break;
diff --git a/arm_compute/graph/Types.h b/arm_compute/graph/Types.h
index 8377253..4d9e031 100644
--- a/arm_compute/graph/Types.h
+++ b/arm_compute/graph/Types.h
@@ -26,6 +26,7 @@
#include "arm_compute/core/Error.h"
#include "arm_compute/core/Types.h"
+#include "arm_compute/runtime/CL/CLTunerTypes.h"
#include <limits>
#include <string>
@@ -34,6 +35,7 @@
{
namespace graph
{
+using arm_compute::CLTunerMode;
using arm_compute::Status;
using arm_compute::Coordinates;
@@ -71,13 +73,13 @@
// Forward declarations
class TensorDescriptor;
-
/** Graph configuration structure */
struct GraphConfig
{
bool use_function_memory_manager{ true }; /**< Use a memory manager to manage per-funcion auxilary memory */
bool use_transition_memory_manager{ true }; /**< Use a memory manager to manager transition buffer memory */
bool use_tuner{ false }; /**< Use a tuner in tunable backends */
+ CLTunerMode tuner_mode{ CLTunerMode::EXHAUSTIVE }; /**< Tuner mode to be used by the CL tuner */
int num_threads{ -1 }; /**< Number of threads to use (thread capable backends), if 0 the backend will auto-initialize, if -1 the backend will stay as it is. */
std::string tuner_file{ "acl_tuner.csv" }; /**< File to load/store tuning values from */
};
@@ -138,6 +140,7 @@
EltwiseLayer,
FlattenLayer,
FullyConnectedLayer,
+ FusedConvolutionBatchNormalizationLayer,
GenerateProposalsLayer,
NormalizationLayer,
NormalizePlanarYUVLayer,
@@ -152,6 +155,7 @@
SoftmaxLayer,
SliceLayer,
SplitLayer,
+ StackLayer,
UpsampleLayer,
YOLOLayer,
diff --git a/arm_compute/graph/Utils.h b/arm_compute/graph/Utils.h
index 1a0509b..2fa2f3b 100644
--- a/arm_compute/graph/Utils.h
+++ b/arm_compute/graph/Utils.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018 ARM Limited.
+ * Copyright (c) 2018-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -89,11 +89,12 @@
* @return A PassManager with default mutating passes
*/
PassManager create_default_pass_manager(Target target);
-/** Default setups the graph context if not done manually
+/** Setups requested backend context if it exists, is supported and hasn't been initialized already.
*
- * @param[in,out] ctx Graph Context
+ * @param[in,out] ctx Graph Context.
+ * @param[in] target Target to setup the backend for.
*/
-void setup_default_graph_context(GraphContext &ctx);
+void setup_requested_backend_context(GraphContext &ctx, Target target);
/** Default releases the graph context if not done manually
*
* @param[in,out] ctx Graph Context
@@ -109,12 +110,12 @@
size_t get_dimension_size(const TensorDescriptor &descriptor, const DataLayoutDimension data_layout_dimension);
/** Get index of a tensor's given dimension depending on its layout
*
- * @param[in] descriptor Descriptor
+ * @param[in] data_layout Data layout of the tensor
* @param[in] data_layout_dimension Tensor data layout dimension
*
* @return Idx of given dimension
*/
-size_t get_dimension_idx(const TensorDescriptor &descriptor, const DataLayoutDimension data_layout_dimension);
+size_t get_dimension_idx(DataLayout data_layout, const DataLayoutDimension data_layout_dimension);
/** Get the list of driving nodes of a given node
*
* @param[in] node Node to find the driving node of
diff --git a/arm_compute/graph/backends/CL/CLDeviceBackend.h b/arm_compute/graph/backends/CL/CLDeviceBackend.h
index 49e7596..afe01ff 100644
--- a/arm_compute/graph/backends/CL/CLDeviceBackend.h
+++ b/arm_compute/graph/backends/CL/CLDeviceBackend.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018 ARM Limited.
+ * Copyright (c) 2018-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -50,6 +50,11 @@
* @param[in] enable_tuning Enables tuning if false else true
*/
void set_kernel_tuning(bool enable_tuning);
+ /** Set kernel tuning mode
+ *
+ * @param[in] tuning_mode Indicates how exhaustive the search for the optimal LWS should be while tuning
+ */
+ void set_kernel_tuning_mode(CLTunerMode tuning_mode);
// Inherited overridden methods
void initialize_backend() override;
diff --git a/arm_compute/graph/backends/FunctionHelpers.h b/arm_compute/graph/backends/FunctionHelpers.h
index 7242bc6..f6e6286 100644
--- a/arm_compute/graph/backends/FunctionHelpers.h
+++ b/arm_compute/graph/backends/FunctionHelpers.h
@@ -28,6 +28,8 @@
#include "arm_compute/graph/Tensor.h"
#include "arm_compute/graph/TypePrinter.h"
#include "arm_compute/graph/Types.h"
+#include "arm_compute/graph/Utils.h"
+#include "arm_compute/graph/backends/FusedConvolutionBatchNormalizationFunction.h"
#include "arm_compute/graph/backends/Utils.h"
#include "arm_compute/graph/nodes/Nodes.h"
@@ -108,7 +110,7 @@
ARM_COMPUTE_LOG_GRAPH_INFO("Instantiated "
<< node.name()
<< " Type: " << node.type()
- << " Target " << TargetInfo::TargetType
+ << " Target: " << TargetInfo::TargetType
<< " Data Type: " << input->info()->data_type()
<< " Shape: " << input->info()->tensor_shape()
<< " Activation function: " << act_info.activation()
@@ -135,11 +137,12 @@
validate_node<TargetInfo>(node, 5 /* expected inputs */, 1 /* expected outputs */);
// Extract IO and info
- typename TargetInfo::TensorType *input = get_backing_tensor<TargetInfo>(node.input(0));
- typename TargetInfo::TensorType *mean = get_backing_tensor<TargetInfo>(node.input(1));
- typename TargetInfo::TensorType *var = get_backing_tensor<TargetInfo>(node.input(2));
- typename TargetInfo::TensorType *beta = get_backing_tensor<TargetInfo>(node.input(3));
- typename TargetInfo::TensorType *gamma = get_backing_tensor<TargetInfo>(node.input(4));
+ typename TargetInfo::TensorType *input = get_backing_tensor<TargetInfo>(node.input(0));
+ typename TargetInfo::TensorType *mean = get_backing_tensor<TargetInfo>(node.input(1));
+ typename TargetInfo::TensorType *var = get_backing_tensor<TargetInfo>(node.input(2));
+ typename TargetInfo::TensorType *beta = get_backing_tensor<TargetInfo>(node.input(3));
+ typename TargetInfo::TensorType *gamma = get_backing_tensor<TargetInfo>(node.input(4));
+
typename TargetInfo::TensorType *output = get_backing_tensor<TargetInfo>(node.output(0));
const float epsilon = node.epsilon();
const ActivationLayerInfo fused_act = node.fused_activation();
@@ -163,6 +166,61 @@
return std::move(func);
}
+/** Create a backend batch normalization layer function
+ *
+ * @tparam BatchNormalizationLayerFunction Backend batch normalization function
+ * @tparam TargetInfo Target-specific information
+ *
+ * @param[in] node Node to create the backend function for
+ *
+ * @return Backend batch normalization layer function
+ */
+template <typename FusedLayerTypes, typename TargetInfo>
+std::unique_ptr<IFunction> create_fused_convolution_batch_normalization_layer(FusedConvolutionBatchNormalizationNode &node)
+{
+ validate_node<TargetInfo>(node, 7 /* expected inputs */, 1 /* expected outputs */);
+
+ // Extract IO and info
+ typename TargetInfo::TensorType *input = get_backing_tensor<TargetInfo>(node.input(0));
+ typename TargetInfo::TensorType *weights = get_backing_tensor<TargetInfo>(node.input(1));
+ typename TargetInfo::TensorType *biases = get_backing_tensor<TargetInfo>(node.input(2));
+ typename TargetInfo::TensorType *mean = get_backing_tensor<TargetInfo>(node.input(3));
+ typename TargetInfo::TensorType *var = get_backing_tensor<TargetInfo>(node.input(4));
+ typename TargetInfo::TensorType *beta = get_backing_tensor<TargetInfo>(node.input(5));
+ typename TargetInfo::TensorType *gamma = get_backing_tensor<TargetInfo>(node.input(6));
+
+ typename TargetInfo::TensorType *output = get_backing_tensor<TargetInfo>(node.output(0));
+
+ const PadStrideInfo conv_info = node.convolution_info();
+ const unsigned int num_groups = node.num_groups();
+ const bool fast_math = node.fast_math_hint() == FastMathHint::Enabled;
+ const ActivationLayerInfo fused_act = node.fused_activation();
+ const float epsilon = node.epsilon();
+
+ const bool is_quantized = is_data_type_quantized_asymmetric(input->info()->data_type());
+ if(is_quantized && biases != nullptr)
+ {
+ biases->info()->set_data_type(DataType::S32);
+ }
+
+ // Create and configure function
+ auto func = support::cpp14::make_unique<FusedConvolutionBatchNormalizationFunction<TargetInfo, FusedLayerTypes>>();
+ func->configure(input, weights, biases, output, mean, var, beta, gamma, epsilon, conv_info, num_groups, fast_math, fused_act);
+
+ // Log info
+ ARM_COMPUTE_LOG_GRAPH_INFO("Instantiated "
+ << node.name()
+ << " Type: " << node.name()
+ << " Target: " << TargetInfo::TargetType
+ << " Data Type: " << input->info()->data_type()
+ << " Input shape: " << input->info()->tensor_shape()
+ << " Weights shape: " << weights->info()->tensor_shape()
+ << " Output shape: " << output->info()->tensor_shape()
+ << (fused_act.enabled() ? " " + to_string(fused_act.activation()) : "")
+ << std::endl);
+ return std::move(func);
+}
+
/** Create a backend bounding box transform layer function
*
* @tparam BoundingBoxTransformLayerFunction Backend bounding box transform function
@@ -188,8 +246,10 @@
func->configure(input, output, deltas, bbox_info);
// Log info
- ARM_COMPUTE_LOG_GRAPH_INFO("Instantiated " << node.type()
- << " Target " << TargetInfo::TargetType
+ ARM_COMPUTE_LOG_GRAPH_INFO("Instantiated "
+ << node.name()
+ << " Type: " << node.type()
+ << " Target: " << TargetInfo::TargetType
<< " Data Type: " << input->info()->data_type()
<< " Shape: " << input->info()->tensor_shape()
<< " BoundingBox Info img W: " << bbox_info.img_width() << " "
@@ -262,13 +322,20 @@
inputs.push_back(get_backing_tensor<TargetInfo>(node.input(i)));
}
typename TargetInfo::TensorType *output = get_backing_tensor<TargetInfo>(node.output(0));
- const DataLayoutDimension concat_axis = node.concatenation_axis();
+ const DataLayout data_layout = node.output(0) != nullptr ? node.output(0)->desc().layout : DataLayout::UNKNOWN;
+ const size_t concat_axis = get_dimension_idx(data_layout, node.concatenation_axis());
// Create and configure function
auto func = support::cpp14::make_unique<ConcatenateLayerFunction>();
func->configure(inputs, output, concat_axis);
// Log info
+ const bool is_quantized = is_data_type_quantized_asymmetric(output->info()->data_type());
+ std::ostringstream qss;
+ if(is_quantized)
+ {
+ qss << " Output QuantInfo: " << output->info()->quantization_info();
+ }
ARM_COMPUTE_LOG_GRAPH_INFO("Instantiated "
<< node.name()
<< " Type: " << node.type()
@@ -277,6 +344,7 @@
<< " Shape: " << output->info()->tensor_shape()
<< " Num Inputs: " << inputs.size()
<< " Axis: " << concat_axis
+ << qss.str()
<< std::endl);
return std::move(func);
@@ -364,10 +432,10 @@
<< " Target: " << TargetInfo::TargetType
<< " Data Type: " << input->info()->data_type()
<< " Groups: " << num_groups
- << qss.str()
<< " Input shape: " << input->info()->tensor_shape()
<< " Weights shape: " << weights->info()->tensor_shape()
<< " Output shape: " << output->info()->tensor_shape()
+ << qss.str()
<< (fused_act.enabled() ? " " + to_string(fused_act.activation()) : "")
<< std::endl);
return func;
@@ -479,11 +547,11 @@
<< " Type: " << func_name
<< " Target: " << TargetInfo::TargetType
<< " Data Type: " << input->info()->data_type()
- << qss.str()
<< " Input shape: " << input->info()->tensor_shape()
<< " Weights shape: " << weights->info()->tensor_shape()
<< " Output shape: " << output->info()->tensor_shape()
<< " Depth multiplier: " << depth_multiplier
+ << qss.str()
<< (fused_act.enabled() ? " " + to_string(fused_act.activation()) : "")
<< std::endl);
return func;
@@ -1120,8 +1188,10 @@
func->configure(input, rois, output, pool_info);
// Log info
- ARM_COMPUTE_LOG_GRAPH_INFO("Instantiated " << node.type()
- << " Target " << TargetInfo::TargetType
+ ARM_COMPUTE_LOG_GRAPH_INFO("Instantiated "
+ << node.name()
+ << " Type: " << node.type()
+ << " Target: " << TargetInfo::TargetType
<< " Data Type: " << input->info()->data_type()
<< " Input shape: " << input->info()->tensor_shape()
<< " Output shape: " << output->info()->tensor_shape()
@@ -1208,6 +1278,49 @@
return std::move(func);
}
+
+/** Create a backend layer stack function
+ *
+ * @tparam StackLayerFunction Backend stack function
+ * @tparam TargetInfo Target-specific information
+ *
+ * @param[in] node Node to create the backend function for
+ *
+ * @return Backend stack layer function
+ */
+template <typename StackLayerFunction, typename TargetInfo>
+std::unique_ptr<arm_compute::IFunction> create_stack_layer(StackLayerNode &node)
+{
+ ARM_COMPUTE_LOG_GRAPH_VERBOSE("Creating Stack node with ID : " << node.id() << " and Name: " << node.name() << std::endl);
+ ARM_COMPUTE_ERROR_ON(node.num_outputs() != 1);
+
+ // Extract IO and info
+ std::vector<typename TargetInfo::TensorType *> inputs;
+ for(unsigned int i = 0; i < node.num_inputs(); ++i)
+ {
+ inputs.push_back(get_backing_tensor<TargetInfo>(node.input(i)));
+ }
+ typename TargetInfo::TensorType *output = get_backing_tensor<TargetInfo>(node.output(0));
+ const int axis = node.axis();
+
+ // Create and configure function
+ auto func = support::cpp14::make_unique<StackLayerFunction>();
+ func->configure(inputs, axis, output);
+
+ // Log info
+ ARM_COMPUTE_LOG_GRAPH_INFO("Instantiated "
+ << node.name()
+ << " Type: " << node.type()
+ << " Target: " << TargetInfo::TargetType
+ << " Data Type: " << output->info()->data_type()
+ << " Inputs shape: " << inputs[0]->info()->tensor_shape()
+ << " Output shape: " << output->info()->tensor_shape()
+ << " Num Inputs: " << inputs.size()
+ << " Axis: " << axis
+ << std::endl);
+
+ return std::move(func);
+}
/** Create a backend Upsample layer function
*
* @tparam UpsampleLayerFunction Backend Upsample function
diff --git a/arm_compute/graph/backends/FusedConvolutionBatchNormalizationFunction.h b/arm_compute/graph/backends/FusedConvolutionBatchNormalizationFunction.h
new file mode 100644
index 0000000..92af17b
--- /dev/null
+++ b/arm_compute/graph/backends/FusedConvolutionBatchNormalizationFunction.h
@@ -0,0 +1,133 @@
+/*
+ * Copyright (c) 2019 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_BACKENDS_FUSED_CONVOLUTION_BATCH_NORMAZLIZATION_FUNCTION_H__
+#define __ARM_COMPUTE_GRAPH_BACKENDS_FUSED_CONVOLUTION_BATCH_NORMAZLIZATION_FUNCTION_H__
+
+#include "arm_compute/core/Types.h"
+#include "arm_compute/runtime/IFunction.h"
+
+namespace arm_compute
+{
+namespace graph
+{
+namespace backends
+{
+/** Wrapper function to first apply {NE, CL}BatchNormalizationLayer on the weights and then run {NE, CL}ConvolutionLayer with the modified weights */
+template <typename TargetInfo, typename FusedLayerTypes>
+class FusedConvolutionBatchNormalizationFunction : public IFunction
+{
+public:
+ using TensorType = typename TargetInfo::TensorType;
+ using TensorConcreteType = typename TargetInfo::TensorConcreteType;
+
+ FusedConvolutionBatchNormalizationFunction()
+ : _conv_layer(), _fused_batch_norm_layer(), _fused_bias(), _is_prepared(false)
+ {
+ }
+
+ /** Set the input and output tensors.
+ *
+ * @param[in] input Source tensor. 3 lower dimensions represent a single input [width, height, IFM],
+ * while every optional dimension from 4 and above represent a batch of inputs.
+ * Data types supported: QASYMM8/F16/F32.
+ * @param[in] weights Weights tensor. Weights are 4D tensor with dimensions [kernel_x, kernel_y, IFM, OFM]. Data type supported: Same as @p input.
+ * @param[in] bias Biases tensor. Shared biases supported. Biases are 1D tensor with dimensions [OFM].
+ * Data type supported: Should match @p input data type, except for input of QASYMM8 type where biases should be of S32 type.
+ * @param[out] output Destination tensor. 3 lower dimensions represent a single output [width, height, OFM], while the rest represent batch of outputs.
+ * Data types supported: Same as @p input.
+ * @param[in] mean Mean values tensor. 1 dimension with size equal to the feature maps [FM]. Data types supported: Same as @p input
+ * @param[in] var Variance values tensor. 1 dimension with size equal to the feature maps [FM]. Data types supported: Same as @p input
+ * @param[in] beta Beta values tensor info. 1 dimension with size equal to the feature maps [FM]. If not provided, default value for beta is 0. Data types supported: Same as @p input
+ * @param[in] gamma Gamma values tensor info. 1 dimension with size equal to the feature maps [FM]. If not provided, default value for gamma is 1. Data types supported: Same as @p input
+ * @param[in] epsilon Small value to avoid division with zero. Default value is 0.001f.
+ * @param[in] conv_info Contains padding and stride information described in @ref PadStrideInfo.
+ * @param[in] num_groups Number of groups when performing a grouped convolution. num_groups != 1 is only supported for NCHW data layout
+ * @param[in] fast_math Enable fast math computation. In case this flag were set, the function could dispatch the fastest implementation
+ * available which may introduce a drop of accuracy as well. Default is false
+ * @param[in] fused_act Activation layer information in case of a fused activation.
+ *
+ */
+ void configure(TensorType *input,
+ TensorType *weights,
+ TensorType *bias,
+ TensorType *output,
+ const TensorType *mean,
+ const TensorType *var,
+ const TensorType *beta,
+ const TensorType *gamma,
+ float epsilon, const PadStrideInfo &conv_info, unsigned int num_groups, bool fast_math, ActivationLayerInfo const &fused_act)
+ {
+ // We don't run any validate, as we assume that the layers have been already validated
+ const bool has_bias = (bias != nullptr);
+ const TensorType *bias_to_use;
+
+ // We check if the layer has a bias. If yes, use it in-place. If not, we need to create one
+ // as batch normalization might end up with a bias != 0
+ if(has_bias)
+ {
+ _fused_batch_norm_layer.configure(weights, mean, var, nullptr, nullptr, bias, beta, gamma, epsilon);
+ bias_to_use = bias;
+ }
+ else
+ {
+ _fused_batch_norm_layer.configure(weights, mean, var, nullptr, &_fused_bias, nullptr, beta, gamma, epsilon);
+ bias_to_use = &_fused_bias;
+ }
+
+ _conv_layer.configure(input, weights, bias_to_use, output, conv_info, WeightsInfo(), Size2D(1U, 1U), fused_act, fast_math, num_groups);
+
+ if(!has_bias)
+ {
+ _fused_bias.allocator()->allocate();
+ }
+ }
+
+ // Inherited methods overridden:
+ void run()
+ {
+ prepare();
+ _conv_layer.run();
+ }
+
+ void prepare()
+ {
+ if(!_is_prepared)
+ {
+ _fused_batch_norm_layer.run();
+ _is_prepared = true;
+ }
+ }
+
+private:
+ typename FusedLayerTypes::ConvolutionLayer _conv_layer;
+ typename FusedLayerTypes::FuseBatchNormalization _fused_batch_norm_layer;
+ TensorConcreteType _fused_bias;
+ bool _is_prepared;
+};
+} // namespace backends
+} // namespace graph
+} // namespace arm_compute
+
+#endif /* __ARM_COMPUTE_GRAPH_BACKENDS_FUSED_CONVOLUTION_BATCH_NORMAZLIZATION_FUNCTION_H__ */
diff --git a/arm_compute/graph/backends/ValidateHelpers.h b/arm_compute/graph/backends/ValidateHelpers.h
index 8942be2..dbf8f35 100644
--- a/arm_compute/graph/backends/ValidateHelpers.h
+++ b/arm_compute/graph/backends/ValidateHelpers.h
@@ -203,6 +203,7 @@
return status;
}
+
/** Validates a detection output layer node
*
* @tparam DetectionOutputLayer DetectionOutput layer type
@@ -372,6 +373,29 @@
return ReorgLayer::validate(input, output, node.stride());
}
+/** Validates a Reshape layer node
+ *
+ * @tparam ReshapeLayer Reshape layer type
+ *
+ * @param[in] node Node to validate
+ *
+ * @return Status
+ */
+template <typename ReshapeLayer>
+Status validate_reshape_layer(ReshapeLayerNode &node)
+{
+ ARM_COMPUTE_LOG_GRAPH_VERBOSE("Validating ReshapeLayer node with ID : " << node.id() << " and Name: " << node.name() << std::endl);
+ ARM_COMPUTE_RETURN_ERROR_ON(node.num_inputs() != 1);
+ ARM_COMPUTE_RETURN_ERROR_ON(node.num_outputs() != 1);
+
+ // Extract input and output
+ arm_compute::ITensorInfo *input = detail::get_backing_tensor_info(node.input(0));
+ arm_compute::ITensorInfo *output = detail::get_backing_tensor_info(node.output(0));
+
+ // Validate function
+ return ReshapeLayer::validate(input, output);
+}
+
/** Validates a ROI Align layer node
*
* @tparam ROIAlignLayer ROIAlign layer type
diff --git a/arm_compute/graph/frontend/Layers.h b/arm_compute/graph/frontend/Layers.h
index 1a71c89..a4c03a6 100644
--- a/arm_compute/graph/frontend/Layers.h
+++ b/arm_compute/graph/frontend/Layers.h
@@ -72,22 +72,24 @@
public:
/** Construct an output layer.
*
- * @param[in] accessor Accessor to give output tensor data to.
+ * @param[in] accessor Accessor to give output tensor data to.
+ * @param[in] connection_idx (Optional) Input connection index
*/
- OutputLayer(ITensorAccessorUPtr accessor)
- : _accessor(std::move(accessor))
+ OutputLayer(ITensorAccessorUPtr accessor, unsigned int connection_idx = 0)
+ : _accessor(std::move(accessor)), _connection_idx(connection_idx)
{
}
NodeID create_layer(IStream &s) override
{
NodeParams common_params = { name(), s.hints().target_hint };
- NodeIdxPair input = { s.tail_node(), 0 };
+ NodeIdxPair input = { s.tail_node(), _connection_idx };
return GraphBuilder::add_output_node(s.graph(), common_params, input, std::move(_accessor));
}
private:
ITensorAccessorUPtr _accessor;
+ unsigned int _connection_idx;
};
/** Activation Layer */
@@ -96,10 +98,13 @@
public:
/** Construct an activation layer.
*
- * @param[in] act_info Activation information
+ * @param[in] act_info Activation information
+ * @param[in] out_quant_info (Optional) Output quantization info
*/
- ActivationLayer(ActivationLayerInfo act_info)
- : _act_info(act_info)
+ ActivationLayer(ActivationLayerInfo act_info,
+ const QuantizationInfo out_quant_info = QuantizationInfo())
+ : _act_info(act_info),
+ _out_quant_info(std::move(out_quant_info))
{
}
@@ -107,11 +112,12 @@
{
NodeParams common_params = { name(), s.hints().target_hint };
NodeIdxPair input = { s.tail_node(), 0 };
- return GraphBuilder::add_activation_node(s.graph(), common_params, input, _act_info);
+ return GraphBuilder::add_activation_node(s.graph(), common_params, input, _act_info, std::move(_out_quant_info));
}
private:
- ActivationLayerInfo _act_info;
+ ActivationLayerInfo _act_info;
+ const QuantizationInfo _out_quant_info;
};
/** Batchnormalization Layer */
@@ -225,7 +231,7 @@
*/
template <typename... Ts>
ConcatLayer(SubStream &&sub_stream1, SubStream &&sub_stream2, Ts &&... rest_sub_streams)
- : _sub_streams(), _axis(DataLayoutDimension::CHANNEL)
+ : _sub_streams(), _concat_descriptor(DataLayoutDimension::CHANNEL)
{
_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)));
@@ -238,14 +244,14 @@
}
/** Construct a concatenation layer
*
- * @param[in] axis Axis over the concatenation will be performed
- * @param[in] sub_stream1 First graph branch
- * @param[in] sub_stream2 Second graph branch
- * @param[in] rest_sub_streams Rest sub-graph branches
+ * @param[in] concat_descriptor Concat layer descriptor
+ * @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>
- ConcatLayer(DataLayoutDimension axis, SubStream &&sub_stream1, SubStream &&sub_stream2, Ts &&... rest_sub_streams)
- : _sub_streams(), _axis(axis)
+ ConcatLayer(descriptors::ConcatLayerDescriptor concat_descriptor, SubStream &&sub_stream1, SubStream &&sub_stream2, Ts &&... rest_sub_streams)
+ : _sub_streams(), _concat_descriptor(concat_descriptor)
{
_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)));
@@ -262,7 +268,7 @@
*/
template <typename... Ts>
ConcatLayer(SubStream &&sub_stream)
- : _sub_streams(), _axis(DataLayoutDimension::CHANNEL)
+ : _sub_streams(), _concat_descriptor(DataLayoutDimension::CHANNEL)
{
_sub_streams.push_back(arm_compute::support::cpp14::make_unique<SubStream>(std::move(sub_stream)));
}
@@ -289,14 +295,14 @@
}
}
}
- nid = GraphBuilder::add_concatenate_node(s.graph(), common_params, nodes, _axis);
+ nid = GraphBuilder::add_concatenate_node(s.graph(), common_params, nodes, _concat_descriptor);
}
return nid;
}
private:
std::vector<std::unique_ptr<SubStream>> _sub_streams;
- DataLayoutDimension _axis;
+ descriptors::ConcatLayerDescriptor _concat_descriptor;
};
/** Convolution Layer */
@@ -414,28 +420,31 @@
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.
- * @param[in] depth_multiplier (Optional) Depth multiplier parameter.
- * @param[in] quant_info (Optional) Quantization info used for weights
+ * @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.
+ * @param[in] depth_multiplier (Optional) Depth multiplier parameter.
+ * @param[in] weights_quant_info (Optional) Quantization info used for weights
+ * @param[in] out_quant_info (Optional) Output quantization info
*/
DepthwiseConvolutionLayer(unsigned int conv_width,
unsigned int conv_height,
ITensorAccessorUPtr weights,
ITensorAccessorUPtr bias,
PadStrideInfo conv_info,
- int depth_multiplier = 1,
- const QuantizationInfo quant_info = QuantizationInfo())
+ int depth_multiplier = 1,
+ const QuantizationInfo weights_quant_info = QuantizationInfo(),
+ const QuantizationInfo out_quant_info = QuantizationInfo())
: _conv_width(conv_width),
_conv_height(conv_height),
_conv_info(std::move(conv_info)),
_weights(std::move(weights)),
_bias(std::move(bias)),
_depth_multiplier(depth_multiplier),
- _quant_info(std::move(quant_info))
+ _weights_quant_info(std::move(weights_quant_info)),
+ _out_quant_info(std::move(out_quant_info))
{
}
@@ -446,7 +455,7 @@
return GraphBuilder::add_depthwise_convolution_node(s.graph(), common_params,
input, Size2D(_conv_width, _conv_height), _conv_info, _depth_multiplier,
s.hints().depthwise_convolution_method_hint,
- std::move(_weights), std::move(_bias), std::move(_quant_info));
+ std::move(_weights), std::move(_bias), std::move(_weights_quant_info), std::move(_out_quant_info));
}
private:
@@ -456,7 +465,8 @@
ITensorAccessorUPtr _weights;
ITensorAccessorUPtr _bias;
int _depth_multiplier;
- const QuantizationInfo _quant_info;
+ const QuantizationInfo _weights_quant_info;
+ const QuantizationInfo _out_quant_info;
};
/** DetectionOutput Layer */
class DetectionOutputLayer final : public ILayer
@@ -468,7 +478,7 @@
* @param[in] sub_stream_prior PriorBox graph sub-stream.
* @param[in] detect_info DetectionOutput parameters.
*/
- DetectionOutputLayer(SubStream &&sub_stream_conf, SubStream &&sub_stream_prior, DetectionOutputLayerInfo detect_info)
+ DetectionOutputLayer(SubStream &&sub_stream_conf, SubStream &&sub_stream_prior, const DetectionOutputLayerInfo &detect_info)
: _ss_conf(std::move(sub_stream_conf)), _ss_prior(std::move(sub_stream_prior)), _detect_info(detect_info)
{
}
@@ -578,6 +588,34 @@
: _num_outputs(num_outputs),
_weights(std::move(weights)),
_bias(std::move(bias)),
+ _weights_ss(nullptr),
+ _bias_ss(nullptr),
+ _fc_info(fc_info),
+ _weights_quant_info(std::move(weights_quant_info)),
+ _out_quant_info(std::move(out_quant_info))
+ {
+ }
+
+ /** Construct a fully connected layer.
+ *
+ * @param[in] num_outputs Number of outputs.
+ * @param[in] sub_stream_weights Graph sub-stream for the weights.
+ * @param[in] sub_stream_bias Graph sub-stream for the bias.
+ * @param[in] fc_info (Optional) Fully connected layer metadata
+ * @param[in] weights_quant_info (Optional) Weights quantization information
+ * @param[in] out_quant_info (Optional) Output quantization info
+ */
+ FullyConnectedLayer(unsigned int num_outputs,
+ SubStream &&sub_stream_weights,
+ SubStream &&sub_stream_bias,
+ const FullyConnectedLayerInfo fc_info = FullyConnectedLayerInfo(),
+ const QuantizationInfo weights_quant_info = QuantizationInfo(),
+ const QuantizationInfo out_quant_info = QuantizationInfo())
+ : _num_outputs(num_outputs),
+ _weights(nullptr),
+ _bias(nullptr),
+ _weights_ss(arm_compute::support::cpp14::make_unique<SubStream>(std::move(sub_stream_weights))),
+ _bias_ss(arm_compute::support::cpp14::make_unique<SubStream>(std::move(sub_stream_bias))),
_fc_info(fc_info),
_weights_quant_info(std::move(weights_quant_info)),
_out_quant_info(std::move(out_quant_info))
@@ -594,15 +632,29 @@
{
NodeParams common_params = { name(), 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), _fc_info,
- std::move(_weights_quant_info), std::move(_out_quant_info));
+ if(_weights != nullptr)
+ {
+ return GraphBuilder::add_fully_connected_layer(s.graph(), common_params, input, _num_outputs,
+ std::move(_weights), std::move(_bias), _fc_info,
+ std::move(_weights_quant_info), std::move(_out_quant_info));
+ }
+ else
+ {
+ ARM_COMPUTE_ERROR_ON(_weights_ss == nullptr);
+
+ NodeID bias_nid = (_bias_ss == nullptr) ? EmptyNodeID : _bias_ss->tail_node();
+ return GraphBuilder::add_fully_connected_layer(s.graph(), common_params, input, _num_outputs,
+ _weights_ss->tail_node(), bias_nid, _fc_info,
+ std::move(_out_quant_info));
+ }
}
private:
unsigned int _num_outputs;
ITensorAccessorUPtr _weights;
ITensorAccessorUPtr _bias;
+ std::unique_ptr<SubStream> _weights_ss;
+ std::unique_ptr<SubStream> _bias_ss;
const FullyConnectedLayerInfo _fc_info;
const QuantizationInfo _weights_quant_info;
const QuantizationInfo _out_quant_info;
@@ -786,7 +838,7 @@
* @param[in] sub_stream First graph sub-stream
* @param[in] prior_info PriorBox parameters.
*/
- PriorBoxLayer(SubStream &&sub_stream, PriorBoxLayerInfo prior_info)
+ PriorBoxLayer(SubStream &&sub_stream, const PriorBoxLayerInfo &prior_info)
: _ss(std::move(sub_stream)), _prior_info(prior_info)
{
}
@@ -986,6 +1038,92 @@
float _beta;
};
+/** Stack Layer */
+class StackLayer final : public ILayer
+{
+public:
+ /** Construct a concatenation layer
+ *
+ * @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>
+ StackLayer(SubStream &&sub_stream1, SubStream &&sub_stream2, Ts &&... rest_sub_streams)
+ : _sub_streams(), _axis(0)
+ {
+ _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 concatenation layer
+ *
+ * @param[in] axis Stack layer axis along which to stack the inputs
+ * @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>
+ StackLayer(int axis, SubStream &&sub_stream1, SubStream &&sub_stream2, Ts &&... rest_sub_streams)
+ : _sub_streams(), _axis(axis)
+ {
+ _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 concat layer
+ *
+ * @param[in] sub_stream Sub-stream
+ */
+ template <typename... Ts>
+ StackLayer(SubStream &&sub_stream)
+ : _sub_streams(), _axis(0)
+ {
+ _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 = { name(), s.hints().target_hint };
+ if(_sub_streams.size() == 1 && _sub_streams.at(0) != nullptr)
+ {
+ nid = _sub_streams[0]->tail_node();
+ }
+ else
+ {
+ // Collect tail nodes and stack
+ 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_stack_node(s.graph(), common_params, nodes, _axis);
+ }
+ return nid;
+ }
+
+private:
+ std::vector<std::unique_ptr<SubStream>> _sub_streams;
+ int _axis;
+};
+
/** Upsample Layer */
class UpsampleLayer final : public ILayer
{
diff --git a/arm_compute/graph/mutators/NodeFusionMutator.h b/arm_compute/graph/mutators/NodeFusionMutator.h
index 8f16c65..b9ca464 100644
--- a/arm_compute/graph/mutators/NodeFusionMutator.h
+++ b/arm_compute/graph/mutators/NodeFusionMutator.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018 ARM Limited.
+ * Copyright (c) 2018-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -24,21 +24,13 @@
#ifndef __ARM_COMPUTE_GRAPH_NODE_FUSION_MUTATOR_H__
#define __ARM_COMPUTE_GRAPH_NODE_FUSION_MUTATOR_H__
+#include "arm_compute/graph/Graph.h"
#include "arm_compute/graph/IGraphMutator.h"
namespace arm_compute
{
namespace graph
{
-namespace detail
-{
-/** Fused batch normalization with activation
- *
- * @param[in] g Graph to perform operation fusion on
- */
-void fuse_batch_norm_with_activation(Graph &g);
-} // namespace detail
-
/** Mutation pass to fuss nodes */
class NodeFusionMutator final : public IGraphMutator
{
diff --git a/arm_compute/graph/nodes/ActivationLayerNode.h b/arm_compute/graph/nodes/ActivationLayerNode.h
index 570351b..a17b010 100644
--- a/arm_compute/graph/nodes/ActivationLayerNode.h
+++ b/arm_compute/graph/nodes/ActivationLayerNode.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018 ARM Limited.
+ * Copyright (c) 2018-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -36,9 +36,11 @@
public:
/** Constructor
*
- * @param[in] info Activation Layer information
+ * @param[in] info Activation Layer information
+ * @param[in] out_quant_info (Optional) Output quantization info
*/
- ActivationLayerNode(ActivationLayerInfo info);
+ ActivationLayerNode(ActivationLayerInfo info,
+ QuantizationInfo out_quant_info = QuantizationInfo());
/** Activation metadata accessor
*
* @return The activation info of the layer
@@ -51,8 +53,12 @@
TensorDescriptor configure_output(size_t idx) const override;
void accept(INodeVisitor &v) override;
+public:
+ static constexpr NodeType node_type = NodeType::ActivationLayer;
+
private:
ActivationLayerInfo _info;
+ QuantizationInfo _out_quant_info;
};
} // namespace graph
} // namespace arm_compute
diff --git a/arm_compute/graph/nodes/ConcatenateLayerNode.h b/arm_compute/graph/nodes/ConcatenateLayerNode.h
index 20c8523..fc12284 100644
--- a/arm_compute/graph/nodes/ConcatenateLayerNode.h
+++ b/arm_compute/graph/nodes/ConcatenateLayerNode.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018 ARM Limited.
+ * Copyright (c) 2018-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -36,10 +36,10 @@
public:
/** Constructor
*
- * @param[in] total_nodes Number of nodes that will get concatenated
- * @param[in] axis Concatenation axis
+ * @param[in] total_nodes Number of nodes that will get concatenated
+ * @param[in] concat_descriptor Concatenate Layer Descriptor
*/
- ConcatenateLayerNode(unsigned int total_nodes, DataLayoutDimension axis);
+ ConcatenateLayerNode(unsigned int total_nodes, descriptors::ConcatLayerDescriptor concat_descriptor);
/** Computes concatenations output descriptor
*
* @param[in] input_descriptors Input descriptors
@@ -68,6 +68,12 @@
*/
DataLayoutDimension concatenation_axis() const;
+ /** Concatenation output quantization info accessor
+ *
+ * @return Output quantization info
+ */
+ QuantizationInfo output_quantization_info() const;
+
// Inherited overridden methods:
NodeType type() const override;
bool forward_descriptors() override;
@@ -75,9 +81,9 @@
void accept(INodeVisitor &v) override;
private:
- unsigned int _total_nodes;
- DataLayoutDimension _axis;
- bool _is_enabled;
+ unsigned int _total_nodes;
+ descriptors::ConcatLayerDescriptor _concat_descriptor;
+ bool _is_enabled;
};
} // namespace graph
} // namespace arm_compute
diff --git a/arm_compute/graph/nodes/DepthwiseConvolutionLayerNode.h b/arm_compute/graph/nodes/DepthwiseConvolutionLayerNode.h
index 8c0aae1..fd02734 100644
--- a/arm_compute/graph/nodes/DepthwiseConvolutionLayerNode.h
+++ b/arm_compute/graph/nodes/DepthwiseConvolutionLayerNode.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018 ARM Limited.
+ * Copyright (c) 2018-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -39,10 +39,12 @@
* @param[in] info Convolution layer attributes
* @param[in] depth_multiplier (Optional) Depth multiplier parameter.
* @param[in] method (Optional) Depthwise convolution method to use
+ * @param[in] out_quant_info (Optional) Output quantization info
*/
DepthwiseConvolutionLayerNode(PadStrideInfo info,
int depth_multiplier = 1,
- DepthwiseConvolutionMethod method = DepthwiseConvolutionMethod::Default);
+ DepthwiseConvolutionMethod method = DepthwiseConvolutionMethod::Default,
+ QuantizationInfo out_quant_info = QuantizationInfo());
/** Sets the depthwise convolution method to use
*
* @param[in] method Depthwise convolution method to use
@@ -103,6 +105,7 @@
PadStrideInfo _info;
int _depth_multiplier;
DepthwiseConvolutionMethod _method;
+ QuantizationInfo _out_quant_info;
ActivationLayerInfo _fused_activation;
};
} // namespace graph
diff --git a/arm_compute/graph/nodes/FusedConvolutionBatchNormalizationNode.h b/arm_compute/graph/nodes/FusedConvolutionBatchNormalizationNode.h
new file mode 100644
index 0000000..9b0f5b7
--- /dev/null
+++ b/arm_compute/graph/nodes/FusedConvolutionBatchNormalizationNode.h
@@ -0,0 +1,144 @@
+/*
+ * Copyright (c) 2019 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_FUSED_CONVOLUTION_BATCH_NORMALIZATION_NODE_H__
+#define __ARM_COMPUTE_GRAPH_FUSED_CONVOLUTION_BATCH_NORMALIZATION_NODE_H__
+
+#include "arm_compute/graph/INode.h"
+
+namespace arm_compute
+{
+namespace graph
+{
+/** Batch Normalization node */
+class FusedConvolutionBatchNormalizationNode final : public INode
+{
+public:
+ /** Constructor
+ *
+ * @param[in] epsilon Epsilon parameter.
+ * @param[in] info Convolution layer attributes.
+ * @param[in] num_groups (Optional) Number of groups (Defaults to 1)
+ * @param[in] method (Optional) Convolution method to use
+ * @param[in] fast_math_hint (Optional) Fast math hint
+ * @param[in] out_quant_info (Optional) Output quantization info
+ * @param[in] fused_activation (Optional) Fused activation layer. Disabled if not specified
+ */
+ FusedConvolutionBatchNormalizationNode(float epsilon, PadStrideInfo info,
+ unsigned int num_groups = 1,
+ ConvolutionMethod method = ConvolutionMethod::Default,
+ FastMathHint fast_math_hint = FastMathHint::Disabled,
+ QuantizationInfo out_quant_info = QuantizationInfo(), ActivationLayerInfo fused_activation = ActivationLayerInfo());
+
+ /** Epsilon parameter accessor
+ *
+ * @return Epsilon parameter
+ */
+ float epsilon() const;
+
+ /** Returns fused activation
+ *
+ * @return Fused activation
+ */
+ ActivationLayerInfo fused_activation() const;
+
+ /** Sets fused activation
+ *
+ * @param[in] fused_activation Fused activation to set
+ */
+ void set_fused_activation(ActivationLayerInfo fused_activation);
+
+ /** Computes convolution output descriptor
+ *
+ * @param[in] input_descriptor Input descriptor
+ * @param[in] weights_descriptor Weights descriptor
+ * @param[in] info Convolution operation attributes
+ *
+ * @return Output descriptor
+ */
+ static TensorDescriptor compute_output_descriptor(const TensorDescriptor &input_descriptor,
+ const TensorDescriptor &weights_descriptor,
+ const PadStrideInfo &info);
+
+ /** Sets the convolution layer method to use
+ *
+ * @param[in] method Method to use for convolution
+ */
+ void set_convolution_method(ConvolutionMethod method);
+
+ /** Number of groups in convolution accessor
+ *
+ * @return Number of groups in convolution
+ */
+ unsigned int num_groups() const;
+
+ /** Convolution layer method accessor
+ *
+ * @note This is an indication on which convolution layer implementation to use,
+ * if it fails to be created the library's heuristic approach will be used
+ *
+ * @return Convolution layer method to be used by the node
+ */
+ ConvolutionMethod convolution_method() const;
+
+ /** Sets the fast math fast hint
+ *
+ * @param[in] hint Hint to use for convolution
+ */
+ void set_fast_math_hint(FastMathHint hint);
+
+ /** Fast math hint accessor
+ *
+ * @return Fast math hint to be used by the node
+ */
+ FastMathHint fast_math_hint() const;
+
+ /** Convolution metadata accessor
+ *
+ * @return Convolution information
+ */
+ PadStrideInfo convolution_info() const;
+
+ // Inherited overridden methods:
+ NodeType type() const override;
+ bool forward_descriptors() override;
+ TensorDescriptor configure_output(size_t idx) const override;
+ void accept(INodeVisitor &v) override;
+
+public:
+ static constexpr NodeType node_type = NodeType::FusedConvolutionBatchNormalizationLayer;
+
+private:
+ float _epsilon;
+
+ PadStrideInfo _info;
+ unsigned int _num_groups;
+ ConvolutionMethod _method;
+ FastMathHint _fast_math_hint;
+ QuantizationInfo _out_quant_info;
+ ActivationLayerInfo _fused_activation;
+};
+
+} // namespace graph
+} // namespace arm_compute
+#endif /* __ARM_COMPUTE_GRAPH_BATCH_NORMALIZATION_LAYER_NODE_H__ */
diff --git a/arm_compute/graph/nodes/Nodes.h b/arm_compute/graph/nodes/Nodes.h
index 2406485..4eb6a0f 100644
--- a/arm_compute/graph/nodes/Nodes.h
+++ b/arm_compute/graph/nodes/Nodes.h
@@ -38,6 +38,7 @@
#include "arm_compute/graph/nodes/EltwiseLayerNode.h"
#include "arm_compute/graph/nodes/FlattenLayerNode.h"
#include "arm_compute/graph/nodes/FullyConnectedLayerNode.h"
+#include "arm_compute/graph/nodes/FusedConvolutionBatchNormalizationNode.h"
#include "arm_compute/graph/nodes/GenerateProposalsLayerNode.h"
#include "arm_compute/graph/nodes/InputNode.h"
#include "arm_compute/graph/nodes/NormalizationLayerNode.h"
@@ -54,6 +55,7 @@
#include "arm_compute/graph/nodes/SliceLayerNode.h"
#include "arm_compute/graph/nodes/SoftmaxLayerNode.h"
#include "arm_compute/graph/nodes/SplitLayerNode.h"
+#include "arm_compute/graph/nodes/StackLayerNode.h"
#include "arm_compute/graph/nodes/UpsampleLayerNode.h"
#include "arm_compute/graph/nodes/YOLOLayerNode.h"
diff --git a/arm_compute/graph/nodes/NodesFwd.h b/arm_compute/graph/nodes/NodesFwd.h
index cbda309..06c2e1f 100644
--- a/arm_compute/graph/nodes/NodesFwd.h
+++ b/arm_compute/graph/nodes/NodesFwd.h
@@ -44,6 +44,7 @@
class EltwiseLayerNode;
class FlattenLayerNode;
class FullyConnectedLayerNode;
+class FusedConvolutionBatchNormalizationNode;
class GenerateProposalsLayerNode;
class InputNode;
class NormalizationLayerNode;
@@ -60,6 +61,7 @@
class SoftmaxLayerNode;
class SliceLayerNode;
class SplitLayerNode;
+class StackLayerNode;
class UpsampleLayerNode;
class YOLOLayerNode;
} // namespace graph
diff --git a/arm_compute/graph/nodes/StackLayerNode.h b/arm_compute/graph/nodes/StackLayerNode.h
new file mode 100644
index 0000000..6c83fe2
--- /dev/null
+++ b/arm_compute/graph/nodes/StackLayerNode.h
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2019 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_STACK_LAYER_NODE_H__
+#define __ARM_COMPUTE_GRAPH_STACK_LAYER_NODE_H__
+
+#include "arm_compute/graph/INode.h"
+
+namespace arm_compute
+{
+namespace graph
+{
+/** Stack Layer node */
+class StackLayerNode final : public INode
+{
+public:
+ /** Constructor
+ *
+ * @param[in] total_nodes Number of nodes that will get stacked
+ * @param[in] axis Axis alogn which to stack the input tensors
+ */
+ StackLayerNode(unsigned int total_nodes, int axis);
+ /** Computes stack output descriptor
+ *
+ * @param[in] input_descriptors Input descriptors
+ * @param[in] axis Axis along which to stack the input tensors
+ *
+ * @return Expected output descriptor
+ */
+ static TensorDescriptor compute_output_descriptor(const std::vector<TensorDescriptor> &input_descriptors, int axis);
+ /** Stack axis parameter accessor
+ *
+ * @return Stack axis
+ */
+ int axis() const;
+
+ // Inherited overridden methods:
+ NodeType type() const override;
+ bool forward_descriptors() override;
+ TensorDescriptor configure_output(size_t idx) const override;
+ void accept(INodeVisitor &v) override;
+
+private:
+ unsigned int _total_nodes;
+ int _axis;
+};
+} // namespace graph
+} // namespace arm_compute
+#endif /* __ARM_COMPUTE_GRAPH_STACK_LAYER_NODE_H__ */
diff --git a/arm_compute/graph/printers/DotGraphPrinter.h b/arm_compute/graph/printers/DotGraphPrinter.h
index d4cf692..9d2ea46 100644
--- a/arm_compute/graph/printers/DotGraphPrinter.h
+++ b/arm_compute/graph/printers/DotGraphPrinter.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018 ARM Limited.
+ * Copyright (c) 2018-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -56,6 +56,7 @@
void visit(ConvolutionLayerNode &n) override;
void visit(DepthwiseConvolutionLayerNode &n) override;
void visit(EltwiseLayerNode &n) override;
+ void visit(FusedConvolutionBatchNormalizationNode &n) override;
void visit(NormalizationLayerNode &n) override;
void visit(PoolingLayerNode &n) override;
void default_visit() override;