telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 1 | // |
| 2 | // Copyright © 2017 Arm Ltd. All rights reserved. |
David Beck | ecb56cd | 2018-09-05 12:52:57 +0100 | [diff] [blame] | 3 | // SPDX-License-Identifier: MIT |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 4 | // |
| 5 | |
| 6 | #include "NeonDepthwiseConvolutionBaseWorkload.hpp" |
| 7 | |
| 8 | #include "backends/ArmComputeTensorUtils.hpp" |
| 9 | |
| 10 | namespace armnn |
| 11 | { |
| 12 | |
| 13 | arm_compute::Status NeonDepthwiseConvolutionWorkloadValidate(const TensorInfo& input, |
| 14 | const TensorInfo& output, |
| 15 | const DepthwiseConvolution2dDescriptor& descriptor, |
| 16 | const TensorInfo& weights, |
arovir01 | a682410 | 2018-08-28 17:40:45 +0100 | [diff] [blame] | 17 | const boost::optional<TensorInfo>& biases) |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 18 | { |
| 19 | const arm_compute::TensorInfo aclInputInfo = |
| 20 | armcomputetensorutils::BuildArmComputeTensorInfo(input); |
| 21 | const arm_compute::TensorInfo aclOutputInfo = |
| 22 | armcomputetensorutils::BuildArmComputeTensorInfo(output); |
| 23 | const arm_compute::TensorInfo aclWeightsInfo = |
| 24 | armcomputetensorutils::BuildArmComputeTensorInfo(weights); |
| 25 | |
| 26 | arm_compute::TensorInfo aclBiasesInfo; |
| 27 | arm_compute::TensorInfo *optionalAclBiasesInfo = nullptr; |
arovir01 | a682410 | 2018-08-28 17:40:45 +0100 | [diff] [blame] | 28 | |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 29 | if (descriptor.m_BiasEnabled) |
| 30 | { |
arovir01 | a682410 | 2018-08-28 17:40:45 +0100 | [diff] [blame] | 31 | BOOST_ASSERT(biases.is_initialized()); |
| 32 | |
| 33 | aclBiasesInfo = armcomputetensorutils::BuildArmComputeTensorInfo(biases.get()); |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 34 | optionalAclBiasesInfo = &aclBiasesInfo; |
| 35 | } |
| 36 | |
| 37 | const arm_compute::PadStrideInfo aclPadStrideInfo = |
| 38 | armcomputetensorutils::BuildArmComputePadStrideInfo(descriptor); |
| 39 | const unsigned int aclDepthMultiplier = weights.GetShape()[0]; |
| 40 | |
| 41 | return arm_compute::NEDepthwiseConvolutionLayer::validate(&aclInputInfo, |
| 42 | &aclWeightsInfo, |
| 43 | optionalAclBiasesInfo, |
| 44 | &aclOutputInfo, |
| 45 | aclPadStrideInfo, |
| 46 | aclDepthMultiplier); |
| 47 | } |
| 48 | |
arovir01 | a682410 | 2018-08-28 17:40:45 +0100 | [diff] [blame] | 49 | } |