aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichalis Spyrou <michalis.spyrou@arm.com>2021-04-23 10:32:48 +0100
committerTeresaARM <teresa.charlinreyes@arm.com>2021-04-24 10:40:00 +0000
commita7a74361dc8de813172503d8e1cd5d8c56817fb8 (patch)
treed77988371b8662b017a92af67191821a7f4f3abc
parent6717688ae34be694d06f56f5d22061606b4ee62f (diff)
downloadComputeLibrary-a7a74361dc8de813172503d8e1cd5d8c56817fb8.tar.gz
Fix Depthwise failure in Cpu backend
Resolves: COMPMID-4395 Change-Id: Ib3dfdc42e95998c1e5713d6ec1bdaa83299b0360 Signed-off-by: Michalis Spyrou <michalis.spyrou@arm.com> Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/5488 Reviewed-by: Giorgio Arena <giorgio.arena@arm.com> Reviewed-by: TeresaARM <teresa.charlinreyes@arm.com> Comments-Addressed: Arm Jenkins <bsgcomp@arm.com> Tested-by: Arm Jenkins <bsgcomp@arm.com>
-rw-r--r--src/runtime/NEON/functions/NEDepthwiseConvolutionLayer.cpp5
-rw-r--r--src/runtime/cpu/operators/CpuDepthwiseConvolution.cpp4
2 files changed, 5 insertions, 4 deletions
diff --git a/src/runtime/NEON/functions/NEDepthwiseConvolutionLayer.cpp b/src/runtime/NEON/functions/NEDepthwiseConvolutionLayer.cpp
index 1d7b1c677b..da9610ef42 100644
--- a/src/runtime/NEON/functions/NEDepthwiseConvolutionLayer.cpp
+++ b/src/runtime/NEON/functions/NEDepthwiseConvolutionLayer.cpp
@@ -121,7 +121,7 @@ void NEDepthwiseConvolutionLayer::NEDepthwiseConvolutionLayerOptimizedInternal::
_impl->permuted_output.info()->set_quantization_info(output->info()->quantization_info());
// Configure optimized depthwise
- dwc_optimized_func->configure(_impl->permuted_input.info(), _impl->permuted_weights.info(), biases->info(), _impl->permuted_output.info(), info);
+ dwc_optimized_func->configure(_impl->permuted_input.info(), _impl->permuted_weights.info(), biases == nullptr ? nullptr : biases->info(), _impl->permuted_output.info(), info);
// Configure the function to transform the convoluted output to ACL's native ordering format NCHW
_impl->permuted_output.info()->set_data_layout(DataLayout::NHWC);
@@ -132,7 +132,7 @@ void NEDepthwiseConvolutionLayer::NEDepthwiseConvolutionLayerOptimizedInternal::
}
else
{
- dwc_optimized_func->configure(_impl->src->info(), _impl->weights->info(), biases->info(), _impl->dst->info(), info);
+ dwc_optimized_func->configure(_impl->src->info(), _impl->weights->info(), biases == nullptr ? nullptr : biases->info(), _impl->dst->info(), info);
}
// Allocate memory based on the internal memory requirements
@@ -184,7 +184,6 @@ void NEDepthwiseConvolutionLayer::NEDepthwiseConvolutionLayerOptimizedInternal::
if(_impl->permute)
{
_impl->permuted_weights.allocator()->allocate();
- _impl->weights->mark_as_unused();
}
if(!_impl->permuted_weights.is_used())
diff --git a/src/runtime/cpu/operators/CpuDepthwiseConvolution.cpp b/src/runtime/cpu/operators/CpuDepthwiseConvolution.cpp
index 183a2af0cd..6d097280e0 100644
--- a/src/runtime/cpu/operators/CpuDepthwiseConvolution.cpp
+++ b/src/runtime/cpu/operators/CpuDepthwiseConvolution.cpp
@@ -170,7 +170,7 @@ void CpuDepthwiseConvolution::CpuDepthwiseConvolutionOptimizedInternal::run(ITen
if(_permute)
{
ITensorPack pack;
- auto src = tensors.get_tensor(TensorType::ACL_SRC_0);
+ auto src = tensors.get_const_tensor(TensorType::ACL_SRC_0);
auto src_perm = tensors.get_tensor(TensorType::ACL_INT_0);
pack.add_tensor(TensorType::ACL_SRC, src);
pack.add_tensor(TensorType::ACL_DST, src_perm);
@@ -247,6 +247,8 @@ void CpuDepthwiseConvolution::CpuDepthwiseConvolutionOptimizedInternal::prepare(
pack.add_tensor(TensorType::ACL_DST, permuted_weights);
_permute_weights->run(pack);
+ weights->mark_as_unused();
+
ITensorPack pack_opt;
pack_opt.add_const_tensor(TensorType::ACL_SRC_1, permuted_weights);
pack_opt.add_tensor(TensorType::ACL_SRC_2, bias);