COMPMID-550: Adds support for branches.

Change-Id: I778007c9221ce3156400284c4039b90245eb2b7f
Reviewed-on: http://mpd-gerrit.cambridge.arm.com/90043
Tested-by: Kaizen <jeremy.johnson+kaizengerrit@arm.com>
Reviewed-by: Anthony Barbier <anthony.barbier@arm.com>
diff --git a/arm_compute/graph/CL/CLMap.h b/arm_compute/graph/CL/CLMap.h
index a205ebc..732a1df 100644
--- a/arm_compute/graph/CL/CLMap.h
+++ b/arm_compute/graph/CL/CLMap.h
@@ -29,11 +29,11 @@
 
 namespace arm_compute
 {
-class CLTensor;
+class ICLTensor;
 
 namespace graph
 {
-class Tensor;
+class ITensorObject;
 /** OpenCL map function */
 class CLMap : public arm_compute::IFunction
 {
@@ -43,7 +43,7 @@
      * @param[in] tensor   Tensor to map
      * @param[in] blocking Flag to specify if the map should be blocking or not (defaults to false)
      */
-    CLMap(Tensor *tensor, bool blocking = false);
+    CLMap(ITensorObject *tensor, bool blocking = false);
     /** Prevent instances from being copy constructed */
     CLMap(const CLMap &) = delete;
     /** Prevent instances from being copy assigned */
@@ -57,8 +57,8 @@
     void run() override;
 
 private:
-    arm_compute::CLTensor *_tensor;   /**< Tensor */
-    bool                   _blocking; /**< Blocking flag */
+    arm_compute::ICLTensor *_tensor;   /**< Tensor */
+    bool                    _blocking; /**< Blocking flag */
 };
 } // namespace graph
 } // namespace arm_compute
diff --git a/arm_compute/graph/CL/CLUnmap.h b/arm_compute/graph/CL/CLUnmap.h
index a727063..17745c4 100644
--- a/arm_compute/graph/CL/CLUnmap.h
+++ b/arm_compute/graph/CL/CLUnmap.h
@@ -29,11 +29,11 @@
 
 namespace arm_compute
 {
-class CLTensor;
+class ICLTensor;
 
 namespace graph
 {
-class Tensor;
+class ITensorObject;
 /** OpenCL un-map function */
 class CLUnmap : public arm_compute::IFunction
 {
@@ -42,7 +42,7 @@
      *
      * @param[in] tensor Tensor to un-map
      */
-    CLUnmap(Tensor *tensor);
+    CLUnmap(ITensorObject *tensor);
     /** Prevent instances from being copy constructed */
     CLUnmap(const CLUnmap &) = delete;
     /** Prevent instances from being copy assigned */
@@ -56,7 +56,7 @@
     void run() override;
 
 private:
-    arm_compute::CLTensor *_tensor; /**< Tensor */
+    arm_compute::ICLTensor *_tensor; /**< Tensor */
 };
 } // namespace graph
 } // namespace arm_compute
diff --git a/arm_compute/graph/Graph.h b/arm_compute/graph/Graph.h
index 9d06f44..4afe96b 100644
--- a/arm_compute/graph/Graph.h
+++ b/arm_compute/graph/Graph.h
@@ -25,6 +25,8 @@
 #define __ARM_COMPUTE_GRAPH_GRAPH_H__
 
 #include "arm_compute/graph/INode.h"
+#include "arm_compute/graph/ITensorObject.h"
+#include "arm_compute/graph/SubTensor.h"
 #include "arm_compute/graph/Tensor.h"
 #include "arm_compute/graph/Types.h"
 #include "support/ToolchainSupport.h"
@@ -64,7 +66,7 @@
      *
      * @param[in] tensor Tensor to add
      */
-    void add_tensor(std::unique_ptr<Tensor> tensor);
+    void add_tensor_object(std::unique_ptr<ITensorObject> tensor);
     /** Manually sets the output of the current node
      *
      * @param[in] tmp Output info to set
@@ -98,6 +100,14 @@
  * @return Updated graph
  */
 Graph &operator<<(Graph &graph, Tensor &&tensor);
+/** Overloaded stream operator to add a sub-tensor to the graph
+ *
+ * @param[in, out] graph      Graph to add the tensor
+ * @param[in]      sub_tensor Sub-tensor to be added
+ *
+ * @return Updated graph
+ */
+Graph &operator<<(Graph &graph, SubTensor &&sub_tensor);
 /** Overloaded stream operator to provide a target hint to the graph
  *
  * @param[in, out] graph       Graph to provide the hint to
diff --git a/arm_compute/graph/INode.h b/arm_compute/graph/INode.h
index 1b22bdf..56b50b9 100644
--- a/arm_compute/graph/INode.h
+++ b/arm_compute/graph/INode.h
@@ -25,6 +25,7 @@
 #define __ARM_COMPUTE_GRAPH_INODE_H__
 
 #include "arm_compute/graph/GraphContext.h"
+#include "arm_compute/graph/ITensorObject.h"
 #include "arm_compute/graph/Types.h"
 #include "arm_compute/runtime/IFunction.h"
 
@@ -46,7 +47,7 @@
      * @param[in] input  Input tensor of the node
      * @param[in] output Output tensor of the node
      */
-    virtual std::unique_ptr<arm_compute::IFunction> instantiate_node(GraphContext &ctx, ITensor *input, ITensor *output) = 0;
+    virtual std::unique_ptr<arm_compute::IFunction> instantiate_node(GraphContext &ctx, ITensorObject *input, ITensorObject *output) = 0;
     /** Override the existing target hint
      *
      * @note If the input is DONT_CARE then the method has to pick a technology,
diff --git a/arm_compute/graph/ITensorObject.h b/arm_compute/graph/ITensorObject.h
new file mode 100644
index 0000000..61be286
--- /dev/null
+++ b/arm_compute/graph/ITensorObject.h
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2017 ARM Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+#ifndef __ARM_COMPUTE_GRAPH_ITENSOROBJECT_H__
+#define __ARM_COMPUTE_GRAPH_ITENSOROBJECT_H__
+
+#include "arm_compute/graph/ITensorAccessor.h"
+#include "arm_compute/graph/Types.h"
+#include "support/ToolchainSupport.h"
+
+#include <memory>
+
+namespace arm_compute
+{
+namespace graph
+{
+/** Tensor object interface */
+class ITensorObject
+{
+public:
+    /** Default Destructor */
+    virtual ~ITensorObject() = default;
+    /** Calls accessor on tensor
+     *
+     * @return True if succeeds else false
+     */
+    virtual bool call_accessor() = 0;
+    /** Checks if tensor has an accessor set.
+     *
+     * @return True if an accessor has been set else false
+     */
+    virtual bool has_accessor() const = 0;
+    /** Sets target of the tensor
+     *
+     * @param[in] target Target where the tensor should be pinned in
+     *
+     * @return Backend tensor
+     */
+    virtual ITensor *set_target(TargetHint target) = 0;
+    /** Returns a pointer to the internal tensor
+     *
+     * @return Tensor
+     */
+    virtual ITensor *tensor() = 0;
+    /** Return the target that this tensor is pinned on
+     *
+     * @return Target of the tensor
+     */
+    virtual TargetHint target() const = 0;
+    /** Allocates the tensor */
+    virtual void allocate() = 0;
+};
+} // namespace graph
+} // namespace arm_compute
+#endif /* __ARM_COMPUTE_GRAPH_ITENSOROBJECT_H__ */
diff --git a/arm_compute/graph/Nodes.h b/arm_compute/graph/Nodes.h
index 548deab..d1ed715 100644
--- a/arm_compute/graph/Nodes.h
+++ b/arm_compute/graph/Nodes.h
@@ -26,6 +26,7 @@
 
 #include "arm_compute/graph/nodes/ActivationLayer.h"
 #include "arm_compute/graph/nodes/BatchNormalizationLayer.h"
+#include "arm_compute/graph/nodes/BranchLayer.h"
 #include "arm_compute/graph/nodes/ConvolutionLayer.h"
 #include "arm_compute/graph/nodes/FloorLayer.h"
 #include "arm_compute/graph/nodes/FullyConnectedLayer.h"
diff --git a/arm_compute/graph/SubGraph.h b/arm_compute/graph/SubGraph.h
new file mode 100644
index 0000000..d768bf9
--- /dev/null
+++ b/arm_compute/graph/SubGraph.h
@@ -0,0 +1,94 @@
+/*
+ * Copyright (c) 2017 ARM Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+#ifndef __ARM_COMPUTE_GRAPH_SUBGRAPH_H__
+#define __ARM_COMPUTE_GRAPH_SUBGRAPH_H__
+
+#include "arm_compute/graph/Graph.h"
+#include "arm_compute/graph/INode.h"
+#include "arm_compute/graph/ITensorObject.h"
+#include "arm_compute/graph/SubTensor.h"
+#include "arm_compute/graph/Tensor.h"
+#include "arm_compute/graph/Types.h"
+#include "arm_compute/runtime/IFunction.h"
+
+#include <memory>
+
+namespace arm_compute
+{
+namespace graph
+{
+/** SubGraph class */
+class SubGraph
+{
+public:
+    /** Constructor */
+    SubGraph();
+    /** Adds a node to the graph
+     *
+     * @param[in] node Node to add
+     */
+    void add_node(std::unique_ptr<INode> node);
+    /** Adds a tensor to the graph
+     *
+     * @param[in] tensor Tensor to add
+     */
+    void add_tensor_object(std::unique_ptr<ITensorObject> tensor);
+    /** Constructs a graph from a subgraph
+     *
+     * @param[in] hint   Execution target hint
+     * @param[in] input  Input to the graph
+     * @param[in] output Output to the graph
+     *
+     * @return A graph
+     */
+    std::unique_ptr<Graph> construct(TargetHint hint, std::unique_ptr<ITensorObject> input, std::unique_ptr<ITensorObject> output);
+    /** Checks if the subgraph has an input
+     *
+     * @return True if the sub-graph has an input else false
+     */
+    bool has_input() const;
+    /** Checks if the subgraph has an output
+     *
+     * @return True if the sub-graph has an output else false
+     */
+    bool has_output() const;
+
+private:
+    std::vector<std::unique_ptr<INode>> _nodes;
+    std::unique_ptr<ITensorObject>      _input;
+    std::unique_ptr<ITensorObject>      _output;
+};
+
+SubGraph &operator<<(SubGraph &graph, Tensor &&tensor);
+SubGraph &operator<<(SubGraph &graph, SubTensor &&sub_tensor);
+
+template <typename Node>
+SubGraph &operator<<(SubGraph &sub_graph, Node node)
+{
+    sub_graph.add_node(arm_compute::support::cpp14::make_unique<Node>(std::move(node)));
+    return sub_graph;
+}
+} // namespace graph
+} // namespace arm_compute
+#endif /* __ARM_COMPUTE_GRAPH_INODE_H__ */
diff --git a/arm_compute/graph/SubTensor.h b/arm_compute/graph/SubTensor.h
index ace93d2..22a0a9e 100644
--- a/arm_compute/graph/SubTensor.h
+++ b/arm_compute/graph/SubTensor.h
@@ -25,6 +25,7 @@
 #define __ARM_COMPUTE_GRAPH_SUBTENSOR_H__
 
 #include "arm_compute/graph/ITensorAccessor.h"
+#include "arm_compute/graph/ITensorObject.h"
 #include "arm_compute/graph/Tensor.h"
 #include "arm_compute/graph/Types.h"
 #include "support/ToolchainSupport.h"
@@ -36,7 +37,7 @@
 namespace graph
 {
 /** SubTensor class */
-class SubTensor final
+class SubTensor final : public ITensorObject
 {
 public:
     /** Default Constructor */
@@ -55,7 +56,7 @@
      * @param[in] coords       Starting coordinates of the sub-tensor in the parent tensor
      * @param[in] target       Execution target
      */
-    SubTensor(ITensor *parent, TensorShape tensor_shape, Coordinates coords, TargetHint target);
+    SubTensor(arm_compute::ITensor *parent, TensorShape tensor_shape, Coordinates coords, TargetHint target);
     /** Prevent instances of this class from being copied (As this class contains pointers) */
     SubTensor(const SubTensor &) = delete;
     /** Prevent instances of this class from being copied (As this class contains pointers) */
@@ -67,37 +68,24 @@
     /** Default Destructor */
     ~SubTensor() = default;
 
-    /** Sets the given TensorInfo to the tensor
-     *
-     * @param[in] info TensorInfo to set
-     */
-    void set_info(SubTensorInfo &&info);
-    /** Returns tensor's TensorInfo
-     *
-     * @return TensorInfo of the tensor
-     */
-    const SubTensorInfo &info() const;
-    /** Returns a pointer to the internal tensor
-     *
-     * @return Tensor
-     */
-    ITensor *tensor();
-    /** Return the target that this tensor is pinned on
-     *
-     * @return Target of the tensor
-     */
-    TargetHint target() const;
+    // Inherited methods overriden:
+    bool                  call_accessor() override;
+    bool                  has_accessor() const override;
+    arm_compute::ITensor *set_target(TargetHint target) override;
+    arm_compute::ITensor *tensor() override;
+    TargetHint            target() const override;
+    void                  allocate() override;
 
 private:
     /** Instantiates a sub-tensor */
     void instantiate_subtensor();
 
 private:
-    TargetHint               _target;    /**< Target that this tensor is pinned on */
-    Coordinates              _coords;    /**< SubTensor Coordinates */
-    SubTensorInfo            _info;      /**< SubTensor metadata */
-    ITensor                 *_parent;    /**< Parent tensor */
-    std::unique_ptr<ITensor> _subtensor; /**< SubTensor */
+    TargetHint                            _target;       /**< Target that this tensor is pinned on */
+    TensorShape                           _tensor_shape; /**< SubTensor shape */
+    Coordinates                           _coords;       /**< SubTensor Coordinates */
+    arm_compute::ITensor                 *_parent;       /**< Parent tensor */
+    std::unique_ptr<arm_compute::ITensor> _subtensor;    /**< SubTensor */
 };
 } // namespace graph
 } // namespace arm_compute
diff --git a/arm_compute/graph/Tensor.h b/arm_compute/graph/Tensor.h
index 9fdd56d..dcb0c66 100644
--- a/arm_compute/graph/Tensor.h
+++ b/arm_compute/graph/Tensor.h
@@ -25,6 +25,7 @@
 #define __ARM_COMPUTE_GRAPH_TENSOR_H__
 
 #include "arm_compute/graph/ITensorAccessor.h"
+#include "arm_compute/graph/ITensorObject.h"
 #include "arm_compute/graph/Types.h"
 #include "support/ToolchainSupport.h"
 
@@ -35,7 +36,7 @@
 namespace graph
 {
 /** Tensor class */
-class Tensor
+class Tensor final : public ITensorObject
 {
 public:
     /** Constructor
@@ -84,43 +85,27 @@
      * @param[in] info TensorInfo to set
      */
     void set_info(TensorInfo &&info);
-    /** Calls accessor on tensor
-     *
-     * @return True if succeeds else false
-     */
-    bool call_accessor();
-    /** Sets target of the tensor
-     *
-     * @param[in] target Target where the tensor should be pinned in
-     *
-     * @return
-     */
-    ITensor *set_target(TargetHint target);
     /** Returns tensor's TensorInfo
      *
      * @return TensorInfo of the tensor
      */
     const TensorInfo &info() const;
-    /** Returns a pointer to the internal tensor
-     *
-     * @return Tensor
-     */
-    ITensor *tensor();
     /** Allocates and fills the tensor if needed */
     void allocate_and_fill_if_needed();
-    /** Allocates the tensor */
-    void allocate();
-    /** Return the target that this tensor is pinned on
-     *
-     * @return Target of the tensor
-     */
-    TargetHint target() const;
+
+    // Inherited methods overriden:
+    bool                  call_accessor() override;
+    bool                  has_accessor() const override;
+    arm_compute::ITensor *set_target(TargetHint target) override;
+    arm_compute::ITensor *tensor() override;
+    TargetHint            target() const override;
+    void                  allocate() override;
 
 private:
-    TargetHint                       _target;   /**< Target that this tensor is pinned on */
-    TensorInfo                       _info;     /**< Tensor metadata */
-    std::unique_ptr<ITensorAccessor> _accessor; /**< Tensor Accessor */
-    std::unique_ptr<ITensor>         _tensor;   /**< Tensor */
+    TargetHint                            _target;   /**< Target that this tensor is pinned on */
+    TensorInfo                            _info;     /**< Tensor metadata */
+    std::unique_ptr<ITensorAccessor>      _accessor; /**< Tensor Accessor */
+    std::unique_ptr<arm_compute::ITensor> _tensor;   /**< Tensor */
 };
 } // namespace graph
 } // namespace arm_compute
diff --git a/arm_compute/graph/Types.h b/arm_compute/graph/Types.h
index e48ff84..c439641 100644
--- a/arm_compute/graph/Types.h
+++ b/arm_compute/graph/Types.h
@@ -32,19 +32,20 @@
 {
 namespace graph
 {
-using arm_compute::ITensor;
-using arm_compute::TensorInfo;
-using arm_compute::SubTensorInfo;
-using arm_compute::DataType;
-using arm_compute::Coordinates;
-using arm_compute::TensorShape;
-using arm_compute::PadStrideInfo;
-using arm_compute::WeightsInfo;
 using arm_compute::ActivationLayerInfo;
+using arm_compute::Coordinates;
+using arm_compute::DataType;
+using arm_compute::DimensionRoundingType;
+using arm_compute::ITensorInfo;
 using arm_compute::NormType;
 using arm_compute::NormalizationLayerInfo;
+using arm_compute::PadStrideInfo;
 using arm_compute::PoolingLayerInfo;
 using arm_compute::PoolingType;
+using arm_compute::SubTensorInfo;
+using arm_compute::TensorInfo;
+using arm_compute::TensorShape;
+using arm_compute::WeightsInfo;
 
 /**< Execution hint to the graph executor */
 enum class TargetHint
@@ -54,12 +55,18 @@
     NEON       /**< Run node on a NEON capable device */
 };
 
-/**< Convolution method hint to the graph executor */
+/** Convolution method hint to the graph executor */
 enum class ConvolutionMethodHint
 {
     GEMM,  /**< Convolution using GEMM */
     DIRECT /**< Direct convolution */
 };
+
+/** Branch layer merging method */
+enum class BranchMergeMethod
+{
+    DEPTH_CONCATENATE /**< Concatenate across depth */
+};
 } // namespace graph
 } // namespace arm_compute
 #endif /*__ARM_COMPUTE_GRAPH_TYPES_H__*/
diff --git a/arm_compute/graph/nodes/ActivationLayer.h b/arm_compute/graph/nodes/ActivationLayer.h
index efe8112..bc619a8 100644
--- a/arm_compute/graph/nodes/ActivationLayer.h
+++ b/arm_compute/graph/nodes/ActivationLayer.h
@@ -26,7 +26,7 @@
 
 #include "arm_compute/graph/GraphContext.h"
 #include "arm_compute/graph/INode.h"
-#include "arm_compute/graph/Tensor.h"
+#include "arm_compute/graph/ITensorObject.h"
 #include "arm_compute/graph/Types.h"
 
 namespace arm_compute
@@ -44,7 +44,7 @@
     ActivationLayer(const ActivationLayerInfo activation_info);
 
     // Inherited methods overriden:
-    std::unique_ptr<arm_compute::IFunction> instantiate_node(GraphContext &ctx, ITensor *input, ITensor *output) override;
+    std::unique_ptr<arm_compute::IFunction> instantiate_node(GraphContext &ctx, ITensorObject *input, ITensorObject *output) override;
 
 private:
     const ActivationLayerInfo _activation_info; /**< Activation layer info */
diff --git a/arm_compute/graph/nodes/BatchNormalizationLayer.h b/arm_compute/graph/nodes/BatchNormalizationLayer.h
index f01cac2..df7b1d1 100644
--- a/arm_compute/graph/nodes/BatchNormalizationLayer.h
+++ b/arm_compute/graph/nodes/BatchNormalizationLayer.h
@@ -26,6 +26,7 @@
 
 #include "arm_compute/graph/GraphContext.h"
 #include "arm_compute/graph/INode.h"
+#include "arm_compute/graph/ITensorObject.h"
 #include "arm_compute/graph/Tensor.h"
 #include "arm_compute/graph/Types.h"
 
@@ -52,7 +53,7 @@
     }
 
     // Inherited methods overriden:
-    std::unique_ptr<arm_compute::IFunction> instantiate_node(GraphContext &ctx, ITensor *input, ITensor *output) override;
+    std::unique_ptr<arm_compute::IFunction> instantiate_node(GraphContext &ctx, ITensorObject *input, ITensorObject *output) override;
 
 private:
     Tensor _mean;
diff --git a/arm_compute/graph/nodes/BranchLayer.h b/arm_compute/graph/nodes/BranchLayer.h
new file mode 100644
index 0000000..3d13f5f
--- /dev/null
+++ b/arm_compute/graph/nodes/BranchLayer.h
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2017 ARM Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+#ifndef __ARM_COMPUTE_GRAPH_BRANCH_LAYER_H__
+#define __ARM_COMPUTE_GRAPH_BRANCH_LAYER_H__
+
+#include "arm_compute/graph/GraphContext.h"
+#include "arm_compute/graph/INode.h"
+#include "arm_compute/graph/ITensorObject.h"
+#include "arm_compute/graph/SubGraph.h"
+#include "arm_compute/graph/SubTensor.h"
+#include "arm_compute/graph/Types.h"
+
+#include "arm_compute/core/Helpers.h"
+
+#include <vector>
+
+namespace arm_compute
+{
+namespace graph
+{
+/** Branch Layer node */
+class BranchLayer final : public INode
+{
+public:
+    /** Default Constructor
+     *
+     * @param[in] merge_method    Branch merging method
+     * @param[in] sub_graph1      First graph branch
+     * @param[in] sub_graph2      Second graph branch
+     * @param[in] rest_sub_graphs Rest sub-graph branches
+     */
+    template <typename... Ts>
+    BranchLayer(BranchMergeMethod merge_method, SubGraph &&sub_graph1, SubGraph &&sub_graph2, Ts &&... rest_sub_graphs)
+        : _branch_merge_method(merge_method), _sub_graphs()
+    {
+        /* TODO:(geopin01) Use traits to make sure variadic arguments are of SubGraph type */
+        _sub_graphs.push_back(arm_compute::support::cpp14::make_unique<SubGraph>(std::move(sub_graph1)));
+        _sub_graphs.push_back(arm_compute::support::cpp14::make_unique<SubGraph>(std::move(sub_graph2)));
+
+        for_each([&](SubGraph & sub_graph)
+        {
+            _sub_graphs.push_back(arm_compute::support::cpp14::make_unique<SubGraph>(std::move(sub_graph)));
+        },
+        std::move(rest_sub_graphs)...);
+    }
+
+    // Inherited methods overriden:
+    std::unique_ptr<arm_compute::IFunction> instantiate_node(GraphContext &ctx, ITensorObject *input, ITensorObject *output) override;
+
+private:
+    BranchMergeMethod                      _branch_merge_method;
+    std::vector<std::unique_ptr<SubGraph>> _sub_graphs;
+};
+} // namespace graph
+} // namespace arm_compute
+#endif /* __ARM_COMPUTE_GRAPH_BRANCH_LAYER_H__ */
diff --git a/arm_compute/graph/nodes/ConvolutionLayer.h b/arm_compute/graph/nodes/ConvolutionLayer.h
index 04ba3dd..0905524 100644
--- a/arm_compute/graph/nodes/ConvolutionLayer.h
+++ b/arm_compute/graph/nodes/ConvolutionLayer.h
@@ -26,6 +26,7 @@
 
 #include "arm_compute/graph/GraphContext.h"
 #include "arm_compute/graph/INode.h"
+#include "arm_compute/graph/ITensorObject.h"
 #include "arm_compute/graph/SubTensor.h"
 #include "arm_compute/graph/Tensor.h"
 #include "arm_compute/graph/Types.h"
@@ -77,7 +78,7 @@
     }
 
     // Inherited methods overriden:
-    std::unique_ptr<arm_compute::IFunction> instantiate_node(GraphContext &ctx, ITensor *input, ITensor *output) override;
+    std::unique_ptr<arm_compute::IFunction> instantiate_node(GraphContext &ctx, ITensorObject *input, ITensorObject *output) override;
 
 private:
     /** Instantiates a non-grouped convolution
diff --git a/arm_compute/graph/nodes/DepthConcatenateLayer.h b/arm_compute/graph/nodes/DepthConcatenateLayer.h
new file mode 100644
index 0000000..ac347a4
--- /dev/null
+++ b/arm_compute/graph/nodes/DepthConcatenateLayer.h
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2017 ARM Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+#ifndef __ARM_COMPUTE_GRAPH_DEPTH_CONCATENATE_LAYER_H__
+#define __ARM_COMPUTE_GRAPH_DEPTH_CONCATENATE_LAYER_H__
+
+#include "arm_compute/graph/GraphContext.h"
+#include "arm_compute/graph/INode.h"
+#include "arm_compute/graph/Tensor.h"
+#include "arm_compute/graph/Types.h"
+
+namespace arm_compute
+{
+namespace graph
+{
+/** Depth Concatenate Layer node */
+class DepthConcatenateLayer
+{
+public:
+    /** Default Constructor */
+    DepthConcatenateLayer()                              = default;
+    DepthConcatenateLayer(const DepthConcatenateLayer &) = delete;
+    DepthConcatenateLayer &operator=(const DepthConcatenateLayer &) = delete;
+    DepthConcatenateLayer(DepthConcatenateLayer &&)                 = default;
+    DepthConcatenateLayer &operator=(DepthConcatenateLayer &&) = delete;
+
+    // Inherited methods overriden:
+    std::unique_ptr<arm_compute::IFunction> instantiate_node(GraphContext &ctx, std::vector<ITensor *> inputs, ITensor *output);
+    void print_info();
+
+private:
+    TargetHint             _hint{ TargetHint::DONT_CARE };
+    std::vector<ITensor *> _inputs{ nullptr };
+    ITensor               *_output{ nullptr };
+};
+} // namespace graph
+} // namespace arm_compute
+#endif /* __ARM_COMPUTE_GRAPH_DEPTH_CONCATENATE_LAYER_H__ */
diff --git a/arm_compute/graph/nodes/FloorLayer.h b/arm_compute/graph/nodes/FloorLayer.h
index 40fde3b..f88a5b9 100644
--- a/arm_compute/graph/nodes/FloorLayer.h
+++ b/arm_compute/graph/nodes/FloorLayer.h
@@ -26,7 +26,7 @@
 
 #include "arm_compute/graph/GraphContext.h"
 #include "arm_compute/graph/INode.h"
-#include "arm_compute/graph/Tensor.h"
+#include "arm_compute/graph/ITensorObject.h"
 #include "arm_compute/graph/Types.h"
 namespace arm_compute
 {
@@ -37,7 +37,7 @@
 {
 public:
     // Inherited methods overriden:
-    std::unique_ptr<arm_compute::IFunction> instantiate_node(GraphContext &ctx, ITensor *input, ITensor *output) override;
+    std::unique_ptr<arm_compute::IFunction> instantiate_node(GraphContext &ctx, ITensorObject *input, ITensorObject *output) override;
 };
 
 } // namespace graph
diff --git a/arm_compute/graph/nodes/FullyConnectedLayer.h b/arm_compute/graph/nodes/FullyConnectedLayer.h
index d31e060..270676a 100644
--- a/arm_compute/graph/nodes/FullyConnectedLayer.h
+++ b/arm_compute/graph/nodes/FullyConnectedLayer.h
@@ -26,6 +26,7 @@
 
 #include "arm_compute/graph/GraphContext.h"
 #include "arm_compute/graph/INode.h"
+#include "arm_compute/graph/ITensorObject.h"
 #include "arm_compute/graph/Tensor.h"
 #include "arm_compute/graph/Types.h"
 
@@ -50,7 +51,7 @@
     }
 
     // Inherited methods overriden:
-    std::unique_ptr<arm_compute::IFunction> instantiate_node(GraphContext &ctx, ITensor *input, ITensor *output) override;
+    std::unique_ptr<arm_compute::IFunction> instantiate_node(GraphContext &ctx, ITensorObject *input, ITensorObject *output) override;
 
     // Inherited methods overriden:
 private:
diff --git a/arm_compute/graph/nodes/L2NormalizeLayer.h b/arm_compute/graph/nodes/L2NormalizeLayer.h
index ab333a2..ddc1646 100644
--- a/arm_compute/graph/nodes/L2NormalizeLayer.h
+++ b/arm_compute/graph/nodes/L2NormalizeLayer.h
@@ -26,7 +26,7 @@
 
 #include "arm_compute/graph/GraphContext.h"
 #include "arm_compute/graph/INode.h"
-#include "arm_compute/graph/Tensor.h"
+#include "arm_compute/graph/ITensorObject.h"
 #include "arm_compute/graph/Types.h"
 
 namespace arm_compute
@@ -48,7 +48,7 @@
     }
 
     // Inherited methods overriden:
-    std::unique_ptr<arm_compute::IFunction> instantiate_node(GraphContext &ctx, ITensor *input, ITensor *output) override;
+    std::unique_ptr<arm_compute::IFunction> instantiate_node(GraphContext &ctx, ITensorObject *input, ITensorObject *output) override;
 
 private:
     unsigned int _axis;
diff --git a/arm_compute/graph/nodes/NormalizationLayer.h b/arm_compute/graph/nodes/NormalizationLayer.h
index 02efd1c..e1c4509 100644
--- a/arm_compute/graph/nodes/NormalizationLayer.h
+++ b/arm_compute/graph/nodes/NormalizationLayer.h
@@ -26,6 +26,7 @@
 
 #include "arm_compute/graph/GraphContext.h"
 #include "arm_compute/graph/INode.h"
+#include "arm_compute/graph/ITensorObject.h"
 #include "arm_compute/graph/Types.h"
 
 namespace arm_compute
@@ -43,7 +44,7 @@
     explicit NormalizationLayer(const NormalizationLayerInfo norm_info);
 
     // Inherited methods overriden:
-    std::unique_ptr<arm_compute::IFunction> instantiate_node(GraphContext &ctx, ITensor *input, ITensor *output) override;
+    std::unique_ptr<arm_compute::IFunction> instantiate_node(GraphContext &ctx, ITensorObject *input, ITensorObject *output) override;
 
 private:
     const NormalizationLayerInfo _norm_info; /**< Normalization layer information */
diff --git a/arm_compute/graph/nodes/PoolingLayer.h b/arm_compute/graph/nodes/PoolingLayer.h
index 87b15d0..5c45bc0 100644
--- a/arm_compute/graph/nodes/PoolingLayer.h
+++ b/arm_compute/graph/nodes/PoolingLayer.h
@@ -26,7 +26,7 @@
 
 #include "arm_compute/graph/GraphContext.h"
 #include "arm_compute/graph/INode.h"
-#include "arm_compute/graph/Tensor.h"
+#include "arm_compute/graph/ITensorObject.h"
 #include "arm_compute/graph/Types.h"
 
 namespace arm_compute
@@ -44,7 +44,7 @@
     PoolingLayer(const PoolingLayerInfo pool_info);
 
     // Inherited methods overriden:
-    std::unique_ptr<arm_compute::IFunction> instantiate_node(GraphContext &ctx, ITensor *input, ITensor *output) override;
+    std::unique_ptr<arm_compute::IFunction> instantiate_node(GraphContext &ctx, ITensorObject *input, ITensorObject *output) override;
 
 private:
     const PoolingLayerInfo _pool_info; /**< Pooling layer information */
diff --git a/arm_compute/graph/nodes/SoftmaxLayer.h b/arm_compute/graph/nodes/SoftmaxLayer.h
index 2e1bd98..b5d1bc5 100644
--- a/arm_compute/graph/nodes/SoftmaxLayer.h
+++ b/arm_compute/graph/nodes/SoftmaxLayer.h
@@ -26,20 +26,19 @@
 
 #include "arm_compute/graph/GraphContext.h"
 #include "arm_compute/graph/INode.h"
-#include "arm_compute/graph/Tensor.h"
+#include "arm_compute/graph/ITensorObject.h"
 #include "arm_compute/graph/Types.h"
 namespace arm_compute
 {
 namespace graph
 {
 /** Softmax layer node */
-class SoftmaxLayer : public INode
+class SoftmaxLayer final : public INode
 {
 public:
     // Inherited methods overriden:
-    std::unique_ptr<arm_compute::IFunction> instantiate_node(GraphContext &ctx, ITensor *input, ITensor *output) override;
+    std::unique_ptr<arm_compute::IFunction> instantiate_node(GraphContext &ctx, ITensorObject *input, ITensorObject *output) override;
 };
-
 } // namespace graph
 } // namespace arm_compute
 #endif /* __ARM_COMPUTE_GRAPH_SOFTMAX_LAYER_H__ */