aboutsummaryrefslogtreecommitdiff
path: root/src/graph/nodes/FullyConnectedLayer.cpp
diff options
context:
space:
mode:
authorGeorgios Pinitas <georgios.pinitas@arm.com>2017-09-26 12:32:57 +0100
committerAnthony Barbier <anthony.barbier@arm.com>2018-11-02 16:35:24 +0000
commit6f669f039fb74675b858bc3703295609a6a3e122 (patch)
tree704847bbebb2439f68309680bd4f4142b876c179 /src/graph/nodes/FullyConnectedLayer.cpp
parent1682430e220eb609752c650f85c0f96e375b6d6a (diff)
downloadComputeLibrary-6f669f039fb74675b858bc3703295609a6a3e122.tar.gz
COMPMID-417: Add grouping in convolution layer
-Adds grouping support in convolution layer -Adds Normalization layer node in graph -Adds alexnet example -Fixes FullyConnectedLayer output autoconfigure (works only for 1d batch space) Change-Id: I5bd75f9a8b08cfd68f7c34745150266c2bc4221f Reviewed-on: http://mpd-gerrit.cambridge.arm.com/89518 Tested-by: Kaizen <jeremy.johnson+kaizengerrit@arm.com> Reviewed-by: Anthony Barbier <anthony.barbier@arm.com>
Diffstat (limited to 'src/graph/nodes/FullyConnectedLayer.cpp')
-rw-r--r--src/graph/nodes/FullyConnectedLayer.cpp24
1 files changed, 20 insertions, 4 deletions
diff --git a/src/graph/nodes/FullyConnectedLayer.cpp b/src/graph/nodes/FullyConnectedLayer.cpp
index 8d244cb515..fcc86be8fa 100644
--- a/src/graph/nodes/FullyConnectedLayer.cpp
+++ b/src/graph/nodes/FullyConnectedLayer.cpp
@@ -33,6 +33,16 @@ using namespace arm_compute::graph;
namespace
{
+TensorShape calculate_fullyconnected_layer_output_shape(const TensorShape &input_shape, unsigned int output_neurons)
+{
+ // Note: Only 1D batch space is supported at the moment
+ unsigned int batches = input_shape[1];
+ if(input_shape.num_dimensions() > 2)
+ {
+ batches = input_shape[3];
+ }
+ return TensorShape(output_neurons, batches);
+}
template <typename FullyConnectedType, typename TensorType, Hint hint>
std::unique_ptr<arm_compute::IFunction> instantiate_function(ITensor *input, Tensor &weights, Tensor &biases, ITensor *output)
{
@@ -95,8 +105,10 @@ std::unique_ptr<arm_compute::IFunction> FullyConnectedLayer::instantiate_node(Hi
_biases.set_info(TensorInfo(TensorShape(_num_neurons), input->info()->num_channels(), input->info()->data_type(), input->info()->fixed_point_position()));
}
- arm_compute::auto_init_if_empty(*output->info(), TensorShape(_num_neurons, input->info()->dimension(1)), input->info()->num_channels(), input->info()->data_type(),
- input->info()->fixed_point_position());
+ // Auto configure output
+ arm_compute::auto_init_if_empty(*output->info(),
+ calculate_fullyconnected_layer_output_shape(input->info()->tensor_shape(), _num_neurons),
+ input->info()->num_channels(), input->info()->data_type(), input->info()->fixed_point_position());
std::unique_ptr<arm_compute::IFunction> func;
_hint = hint;
@@ -125,6 +137,10 @@ void FullyConnectedLayer::print_info()
{
std::cout << "Instantiating NEFullyConnectedLayer";
}
- std::cout << " Type: " << _input->info()->data_type() << " Input Shape: " << _input->info()->tensor_shape() << " Weights shape: " << _weights.info().tensor_shape() << " Biases Shape: " <<
- _biases.info().tensor_shape() << " Output Shape: " << _output->info()->tensor_shape() << std::endl;
+ std::cout << " Type: " << _input->info()->data_type()
+ << " Input Shape: " << _input->info()->tensor_shape()
+ << " Weights shape: " << _weights.info().tensor_shape()
+ << " Biases Shape: " << _biases.info().tensor_shape()
+ << " Output Shape: " << _output->info()->tensor_shape()
+ << std::endl;
}