24 indices_W_ND_Info.
SetShape({ keyIndices[
"W"], keyIndices[
"ND"] });
25 const arm_compute::TensorInfo aclIndicesInfo = BuildArmComputeTensorInfo(indices_W_ND_Info);
29 flattenedCoeff_Info.
SetShape({ keyIndices[
"ND"] });
30 const arm_compute::TensorInfo aclFlattenedCoeffInfo = BuildArmComputeTensorInfo(flattenedCoeff_Info);
33 const arm_compute::TensorInfo aclOutputMulInfo = BuildArmComputeTensorInfo(indices_W_ND_Info);
35 auto statusMul = arm_compute::NEPixelWiseMultiplication::validate(&aclIndicesInfo,
36 &aclFlattenedCoeffInfo,
39 arm_compute::ConvertPolicy::WRAP,
40 arm_compute::RoundingPolicy::TO_ZERO,
41 arm_compute::ActivationLayerInfo());
46 flattenedIndices_Info.
SetShape({ keyIndices[
"W"] });
47 const arm_compute::TensorInfo aclFlattenedIndicesInfo = BuildArmComputeTensorInfo(flattenedIndices_Info);
49 const std::vector<unsigned int> armnnReduceAxes(1, 1);
54 auto statusReduceSum = arm_compute::NEReductionOperation::validate(&aclOutputMulInfo,
55 &aclFlattenedIndicesInfo,
56 static_cast<unsigned int>(coords[0]),
57 arm_compute::ReductionOperation::SUM,
63 params_K_C_Info.
SetShape({ keyIndices[
"K"], keyIndices[
"C"] });
64 const arm_compute::TensorInfo aclParamsInfo = BuildArmComputeTensorInfo(params_K_C_Info);
68 outputGather_Info.
SetShape({ keyIndices[
"W"], keyIndices[
"C"] });
69 const arm_compute::TensorInfo aclOutputGatherInfo = BuildArmComputeTensorInfo(outputGather_Info);
73 arm_compute::NEGather::validate(&aclParamsInfo, &aclFlattenedIndicesInfo, &aclOutputGatherInfo, aclAxis);
76 const arm_compute::TensorInfo aclOutputInfo = BuildArmComputeTensorInfo(outputInfo);
78 auto statusReshape = arm_compute::NEReshapeLayer::validate(&aclOutputGatherInfo, &aclOutputInfo);
81 auto okCode = arm_compute::ErrorCode::OK;
82 if (statusMul.error_code() == okCode &&
83 statusReduceSum.error_code() == okCode &&
84 statusGather.error_code() == okCode &&
85 statusReshape.error_code() == okCode)
88 "All GatherND layers validate status OK.");
93 "GatherND layer validate status failed.");
107 arm_compute::ITensor& input = PolymorphicDowncast<IAclTensorHandle*>(
m_Data.
m_Inputs[0])->GetTensor();
108 arm_compute::ITensor& indices = PolymorphicDowncast<IAclTensorHandle*>(
m_Data.
m_Inputs[1])->GetTensor();
109 arm_compute::ITensor& output = PolymorphicDowncast<IAclTensorHandle*>(
m_Data.
m_Outputs[0])->GetTensor();
120 flattenedIndices_Info.
SetShape({ keyIndices[
"W"] });
121 BuildArmComputeTensor(m_FlattenedIndices, flattenedIndices_Info);
122 armcomputetensorutils::InitialiseArmComputeTensorEmpty(m_FlattenedIndices);
125 indices.info()->set_tensor_shape(BuildArmComputeTensorShape({ keyIndices[
"W"], keyIndices[
"ND"] }));
129 std::vector<int32_t> flattenedCoeff(keyIndices[
"ND"], 1);
130 for (
unsigned int i = 1; i < keyIndices[
"ND"]; ++i)
132 flattenedCoeff[i - 1] =
static_cast<int32_t
>(paramsShape[i]);
134 for (
unsigned int i = keyIndices[
"ND"] - 1; i > 0; --i)
136 flattenedCoeff[i - 1] *= flattenedCoeff[i];
139 flattenedCoeff_Info.
SetShape({ keyIndices[
"ND"] });
140 BuildArmComputeTensor(m_FlattenedCoeff, flattenedCoeff_Info);
141 armcomputetensorutils::InitialiseArmComputeTensorEmpty(m_FlattenedCoeff);
143 "flattenedCoeff must be same data type as m_FlattenedCoeff");
144 CopyArmComputeITensorData<int32_t>(flattenedCoeff.data(), m_FlattenedCoeff);
148 outputMul_Info.
SetShape({ keyIndices[
"W"], keyIndices[
"ND"] });
149 BuildArmComputeTensor(m_OutputMul, outputMul_Info);
150 armcomputetensorutils::InitialiseArmComputeTensorEmpty(m_OutputMul);
153 m_MulLayer.configure(&indices,
157 arm_compute::ConvertPolicy::WRAP,
158 arm_compute::RoundingPolicy::TO_ZERO,
159 arm_compute::ActivationLayerInfo());
162 const std::vector<unsigned int> armnnReduceAxes(1, 1);
166 m_ReduceSumLayer.configure(&m_OutputMul,
168 static_cast<unsigned int>(coords[0]),
169 arm_compute::ReductionOperation::SUM,
174 paramsInfo.
SetShape({ keyIndices[
"K"], keyIndices[
"C"] });
175 input.info()->set_tensor_shape(BuildArmComputeTensorShape(paramsInfo.
GetShape()));
180 outputGather_Info.
SetShape({ keyIndices[
"W"], keyIndices[
"C"] });
181 BuildArmComputeTensor(m_OutputGather, outputGather_Info);
182 armcomputetensorutils::InitialiseArmComputeTensorEmpty(m_OutputGather);
184 m_GatherLayer.configure(&input, &m_FlattenedIndices, &m_OutputGather,
ComputeAclAxis(0, paramsInfo));
187 m_ReshapeLayer.configure(&m_OutputGather, &output);
194 m_ReduceSumLayer.run();
196 m_ReshapeLayer.run();