aboutsummaryrefslogtreecommitdiff
path: root/src/graph
diff options
context:
space:
mode:
authorGiorgio Arena <giorgio.arena@arm.com>2017-12-21 19:50:06 +0000
committerAnthony Barbier <anthony.barbier@arm.com>2018-11-02 16:43:42 +0000
commita66eaa2a374a50b798159d95431c946fdda22a24 (patch)
tree8d321b8280d9151890d161da3779438c50e05fb1 /src/graph
parent621965e3e9ef301d2668c60702f5fb79daea8d26 (diff)
downloadComputeLibrary-a66eaa2a374a50b798159d95431c946fdda22a24.tar.gz
COMPMID-752 Creating an example for QASYMM8 MobileNet
Change-Id: Ic76b3b6adaff8c84ba4d2ca5283d9291c69344f0 Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/114466 Tested-by: Jenkins <bsgcomp@arm.com> Reviewed-by: Pablo Tello <pablo.tello@arm.com> Reviewed-by: Georgios Pinitas <georgios.pinitas@arm.com>
Diffstat (limited to 'src/graph')
-rw-r--r--src/graph/nodes/BranchLayer.cpp7
-rw-r--r--src/graph/nodes/ConvolutionLayer.cpp14
-rw-r--r--src/graph/nodes/DepthwiseConvolutionLayer.cpp9
-rw-r--r--src/graph/nodes/ReshapeLayer.cpp4
4 files changed, 21 insertions, 13 deletions
diff --git a/src/graph/nodes/BranchLayer.cpp b/src/graph/nodes/BranchLayer.cpp
index eea0540741..6352bfc1e3 100644
--- a/src/graph/nodes/BranchLayer.cpp
+++ b/src/graph/nodes/BranchLayer.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 ARM Limited.
+ * Copyright (c) 2017-2018 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -53,7 +53,7 @@ void depth_concatenate_output_info(ITensorInfo *info, ITensorInfo *sub_tensor_in
arm_compute::auto_init_if_empty(*info,
sub_tensor_info->tensor_shape(),
sub_tensor_info->num_channels(),
- sub_tensor_info->data_type(), sub_tensor_info->fixed_point_position());
+ sub_tensor_info->data_type(), sub_tensor_info->fixed_point_position(), sub_tensor_info->quantization_info());
info->set_valid_region(sub_tensor_info->valid_region());
}
else
@@ -170,7 +170,8 @@ std::unique_ptr<arm_compute::IFunction> BranchLayer::instantiate_node(GraphConte
out_info.tensor_shape(),
out_info.num_channels(),
out_info.data_type(),
- out_info.fixed_point_position());
+ out_info.fixed_point_position(),
+ out_info.quantization_info());
return std::move(func);
} \ No newline at end of file
diff --git a/src/graph/nodes/ConvolutionLayer.cpp b/src/graph/nodes/ConvolutionLayer.cpp
index ae4a8d7e6b..53d06ea75f 100644
--- a/src/graph/nodes/ConvolutionLayer.cpp
+++ b/src/graph/nodes/ConvolutionLayer.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 ARM Limited.
+ * Copyright (c) 2017-2018 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -184,14 +184,17 @@ std::unique_ptr<arm_compute::IFunction> ConvolutionLayer::instantiate_node(Graph
// Set weights and biases info
if(_weights.tensor() == nullptr)
{
- _weights.set_info(TensorInfo(TensorShape(_conv_width, _conv_height, in->info()->dimension(2) / _num_groups, _ofm),
+ TensorInfo info = TensorInfo(TensorShape(_conv_width, _conv_height, in->info()->dimension(2) / _num_groups, _ofm),
in->info()->num_channels(),
in->info()->data_type(),
- in->info()->fixed_point_position()));
+ in->info()->fixed_point_position());
+ info.set_quantization_info(_weights_quant_info);
+ _weights.set_info(std::move(info));
}
if(_biases.has_accessor() && _biases.tensor() == nullptr)
{
- _biases.set_info(TensorInfo(TensorShape(_ofm), in->info()->num_channels(), in->info()->data_type(), in->info()->fixed_point_position()));
+ DataType dt = in->info()->data_type();
+ _biases.set_info(TensorInfo(TensorShape(_ofm), in->info()->num_channels(), is_data_type_quantized_asymmetric(dt) ? DataType::S32 : dt, in->info()->fixed_point_position()));
}
std::unique_ptr<arm_compute::IFunction> func;
@@ -213,7 +216,8 @@ std::unique_ptr<arm_compute::IFunction> ConvolutionLayer::instantiate_node(Graph
TensorShape output_shape = calculate_convolution_layer_output_shape(in->info()->tensor_shape(), _weights.info().tensor_shape(), _conv_info);
// Output auto inizialitation if not yet initialized
- arm_compute::auto_init_if_empty(*out->info(), output_shape, 1, in->info()->data_type(), in->info()->fixed_point_position());
+ arm_compute::auto_init_if_empty(*out->info(), output_shape, 1, in->info()->data_type(), in->info()->fixed_point_position(),
+ (_out_quant_info.empty()) ? in->info()->quantization_info() : _out_quant_info);
// Create appropriate convolution function
if(_num_groups == 1)
diff --git a/src/graph/nodes/DepthwiseConvolutionLayer.cpp b/src/graph/nodes/DepthwiseConvolutionLayer.cpp
index b4598538c1..1209d0376e 100644
--- a/src/graph/nodes/DepthwiseConvolutionLayer.cpp
+++ b/src/graph/nodes/DepthwiseConvolutionLayer.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 ARM Limited.
+ * Copyright (c) 2017-2018 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -43,11 +43,14 @@ std::unique_ptr<arm_compute::IFunction> DepthwiseConvolutionLayer::instantiate_n
TensorShape shape = in->info()->tensor_shape();
shape.set(Window::DimX, _conv_width);
shape.set(Window::DimY, _conv_height);
- _weights.set_info(TensorInfo(TensorShape(shape), in->info()->num_channels(), in->info()->data_type(), in->info()->fixed_point_position()));
+ TensorInfo info = TensorInfo(TensorShape(shape), in->info()->num_channels(), in->info()->data_type(), in->info()->fixed_point_position());
+ info.set_quantization_info(_quant_info);
+ _weights.set_info(std::move(info));
}
if(_biases.has_accessor() && _biases.tensor() == nullptr)
{
- _biases.set_info(TensorInfo(TensorShape(in->info()->dimension(2)), in->info()->num_channels(), in->info()->data_type(), in->info()->fixed_point_position()));
+ DataType dt = in->info()->data_type();
+ _biases.set_info(TensorInfo(TensorShape(in->info()->dimension(2)), in->info()->num_channels(), is_data_type_quantized_asymmetric(dt) ? DataType::S32 : dt, in->info()->fixed_point_position()));
}
bool weights_is_loaded = _weights.tensor() != nullptr;
diff --git a/src/graph/nodes/ReshapeLayer.cpp b/src/graph/nodes/ReshapeLayer.cpp
index bbe0739e64..b0c117e418 100644
--- a/src/graph/nodes/ReshapeLayer.cpp
+++ b/src/graph/nodes/ReshapeLayer.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 ARM Limited.
+ * Copyright (c) 2017-2018 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -44,7 +44,7 @@ std::unique_ptr<arm_compute::IFunction> ReshapeLayer::instantiate_node(GraphCont
arm_compute::ITensor *out = output->tensor();
// Auto configure output
- arm_compute::auto_init_if_empty(*out->info(), _shape, 1, in->info()->data_type(), in->info()->fixed_point_position());
+ arm_compute::auto_init_if_empty(*out->info(), _shape, 1, in->info()->data_type(), in->info()->fixed_point_position(), in->info()->quantization_info());
// Create node context
NodeContext node_ctx(OperationType::ReshapeLayer);