diff options
author | Aron Virginas-Tar <Aron.Virginas-Tar@arm.com> | 2019-11-01 11:40:39 +0000 |
---|---|---|
committer | Matteo Martincigh <matteo.martincigh@arm.com> | 2019-11-05 09:04:51 +0000 |
commit | 13b653fd246b31279ae6cb42261671462b52d1be (patch) | |
tree | 011f4efbefcbb615a996b9e0eae256da1d57ed20 /src/backends/aclCommon/ArmComputeTensorUtils.cpp | |
parent | 5236e1d6bcff6ebec7ec10d7d416cc6ead5482dd (diff) | |
download | armnn-13b653fd246b31279ae6cb42261671462b52d1be.tar.gz |
IVGCVSW-3843 Add support of per-axis quantization to BuildArmComputeTensorInfo
Signed-off-by: Aron Virginas-Tar <Aron.Virginas-Tar@arm.com>
Change-Id: I0bb0e9da306eee3e19dc9967a6c8bb01da998deb
Diffstat (limited to 'src/backends/aclCommon/ArmComputeTensorUtils.cpp')
-rw-r--r-- | src/backends/aclCommon/ArmComputeTensorUtils.cpp | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/src/backends/aclCommon/ArmComputeTensorUtils.cpp b/src/backends/aclCommon/ArmComputeTensorUtils.cpp index c7d250a706..b2955b9259 100644 --- a/src/backends/aclCommon/ArmComputeTensorUtils.cpp +++ b/src/backends/aclCommon/ArmComputeTensorUtils.cpp @@ -106,9 +106,11 @@ arm_compute::TensorShape BuildArmComputeTensorShape(const armnn::TensorShape& te arm_compute::TensorInfo BuildArmComputeTensorInfo(const armnn::TensorInfo& tensorInfo) { const arm_compute::TensorShape aclTensorShape = BuildArmComputeTensorShape(tensorInfo.GetShape()); - const arm_compute::DataType aclDataType = GetArmComputeDataType(tensorInfo.GetDataType()); - const arm_compute::QuantizationInfo aclQuantizationInfo(tensorInfo.GetQuantizationScale(), - tensorInfo.GetQuantizationOffset()); + const arm_compute::DataType aclDataType = GetArmComputeDataType(tensorInfo.GetDataType()); + + const arm_compute::QuantizationInfo aclQuantizationInfo = tensorInfo.HasMultipleQuantizationScales() ? + arm_compute::QuantizationInfo(tensorInfo.GetQuantizationScales()) : + arm_compute::QuantizationInfo(tensorInfo.GetQuantizationScale(), tensorInfo.GetQuantizationOffset()); return arm_compute::TensorInfo(aclTensorShape, 1, aclDataType, aclQuantizationInfo); } @@ -116,15 +118,10 @@ arm_compute::TensorInfo BuildArmComputeTensorInfo(const armnn::TensorInfo& tenso arm_compute::TensorInfo BuildArmComputeTensorInfo(const armnn::TensorInfo& tensorInfo, armnn::DataLayout dataLayout) { - const arm_compute::TensorShape aclTensorShape = BuildArmComputeTensorShape(tensorInfo.GetShape()); - const arm_compute::DataType aclDataType = GetArmComputeDataType(tensorInfo.GetDataType()); - const arm_compute::QuantizationInfo aclQuantizationInfo(tensorInfo.GetQuantizationScale(), - tensorInfo.GetQuantizationOffset()); - - arm_compute::TensorInfo clTensorInfo(aclTensorShape, 1, aclDataType, aclQuantizationInfo); - clTensorInfo.set_data_layout(ConvertDataLayout(dataLayout)); + arm_compute::TensorInfo aclTensorInfo = BuildArmComputeTensorInfo(tensorInfo); + aclTensorInfo.set_data_layout(ConvertDataLayout(dataLayout)); - return clTensorInfo; + return aclTensorInfo; } arm_compute::DataLayout ConvertDataLayout(armnn::DataLayout dataLayout) |