diff options
author | Michele Di Giorgio <michele.digiorgio@arm.com> | 2018-07-06 12:34:19 +0100 |
---|---|---|
committer | Anthony Barbier <anthony.barbier@arm.com> | 2018-11-02 16:54:10 +0000 |
commit | 3a3b43111a459f72720ee87d690b47efa9077d33 (patch) | |
tree | 7acf4eb1db8115b64b1b9b19ae1893856b64085c | |
parent | d304e80112e5d246b4bb884d1211eef9381bf034 (diff) | |
download | ComputeLibrary-3a3b43111a459f72720ee87d690b47efa9077d33.tar.gz |
COMPMID-1378: Graph: bias in FullyConnectedLayer should always have data type S32
Change-Id: Ib4a82b11e810664c663dfc66281ff6bf44d2aa6b
Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/139029
Tested-by: Jenkins <bsgcomp@arm.com>
Reviewed-by: Anthony Barbier <anthony.barbier@arm.com>
-rw-r--r-- | src/graph/GraphBuilder.cpp | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/src/graph/GraphBuilder.cpp b/src/graph/GraphBuilder.cpp index cd08f87e07..3b906c0ffd 100644 --- a/src/graph/GraphBuilder.cpp +++ b/src/graph/GraphBuilder.cpp @@ -252,7 +252,11 @@ NodeID GraphBuilder::add_convolution_node(Graph &g, NodeParams params, NodeIdxPa { TensorDescriptor b_desc = input_tensor_desc; b_desc.shape = TensorShape(depth); - b_nid = add_const_node_with_name(g, params, "Bias", b_desc, std::move(bias_accessor)); + if(is_data_type_quantized_asymmetric(input_tensor_desc.data_type)) + { + b_desc.data_type = DataType::S32; + } + b_nid = add_const_node_with_name(g, params, "Bias", b_desc, std::move(bias_accessor)); } if(num_groups == 1) @@ -305,7 +309,11 @@ NodeID GraphBuilder::add_deconvolution_node(Graph &g, NodeParams params, NodeIdx { TensorDescriptor b_desc = input_tensor_desc; b_desc.shape = TensorShape(depth); - b_nid = add_const_node_with_name(g, params, "Bias", b_desc, std::move(bias_accessor)); + if(is_data_type_quantized_asymmetric(input_tensor_desc.data_type)) + { + b_desc.data_type = DataType::S32; + } + b_nid = add_const_node_with_name(g, params, "Bias", b_desc, std::move(bias_accessor)); } // Create convolution node and connect @@ -431,7 +439,11 @@ NodeID GraphBuilder::add_fully_connected_layer(Graph &g, NodeParams params, Node { TensorDescriptor b_desc = input_tensor_desc; b_desc.shape = TensorShape(num_outputs); - b_nid = add_const_node_with_name(g, params, "Bias", b_desc, std::move(bias_accessor)); + if(is_data_type_quantized_asymmetric(input_tensor_desc.data_type)) + { + b_desc.data_type = DataType::S32; + } + b_nid = add_const_node_with_name(g, params, "Bias", b_desc, std::move(bias_accessor)); } // Create convolution node and connect @@ -508,4 +520,4 @@ NodeID GraphBuilder::add_split_node(Graph &g, NodeParams params, NodeIdxPair inp return create_simple_single_input_output_node<SplitLayerNode>(g, params, input, num_splits, axis); } } // namespace graph -} // namespace arm_compute
\ No newline at end of file +} // namespace arm_compute |