14 #include <neon/test/NeonWorkloadFactoryHelper.hpp>
22 unsigned int CalcAclAxis(
unsigned int numDimensions,
unsigned int axis)
24 return (numDimensions - axis) - 1;
30 using namespace armcomputetensorutils;
43 const arm_compute::ITensor& input =
static_cast<IAclTensorHandle*
>(m_Data.m_Inputs[0])->GetTensor();
44 arm_compute::ITensor& outputStateIn =
static_cast<IAclTensorHandle*
>(m_Data.m_Inputs[1])->GetTensor();
45 const arm_compute::ITensor& cellStateIn =
static_cast<IAclTensorHandle*
>(m_Data.m_Inputs[2])->GetTensor();
47 arm_compute::ITensor& outputStateOut =
static_cast<IAclTensorHandle*
>(m_Data.m_Outputs[0])->GetTensor();
48 arm_compute::ITensor& cellStateOut =
static_cast<IAclTensorHandle*
>(m_Data.m_Outputs[1])->GetTensor();
49 arm_compute::ITensor& output =
static_cast<IAclTensorHandle*
>(m_Data.m_Outputs[2])->GetTensor();
57 unsigned int maxTime = m_Data.m_Parameters.m_TimeMajor ? inputLayerShape[0] : inputLayerShape[1];
58 unsigned int batchSize = m_Data.m_Parameters.m_TimeMajor ? inputLayerShape[1] : inputLayerShape[0];
59 unsigned int inputSize = inputLayerShape[2];
60 unsigned int outputSize = outputLayerShape[2];
62 const TensorShape timeMajorShapeInput({maxTime, batchSize, inputSize});
63 const TensorShape timeMajorShapeOutput({maxTime, batchSize, outputSize});
68 if (!m_Data.m_Parameters.m_TimeMajor)
70 std::unique_ptr<arm_compute::NEPermute> layer(
new arm_compute::NEPermute());
73 permuteOutInfo.
SetShape(timeMajorShapeInput);
74 BuildArmComputeTensor(m_PermuteFirstOut, permuteOutInfo);
75 armcomputetensorutils::InitialiseArmComputeTensorEmpty(m_PermuteFirstOut);
78 layer->configure(&input, &m_PermuteFirstOut, arm_compute::PermutationVector(0U,2U,1U));
79 m_Permute1.reset(layer.release());
85 for (
unsigned int i = 0; i < maxTime; ++i)
87 arm_compute::Tensor splitter_out;
88 arm_compute::Tensor concat_in;
90 auto splitterTensorInfo = inputInfo;
91 auto concatTensorInfo = outputInfo;
92 splitterTensorInfo.
SetShape({batchSize, inputSize});
93 concatTensorInfo.SetShape({batchSize, outputSize});
94 BuildArmComputeTensor(splitter_out, splitterTensorInfo);
95 BuildArmComputeTensor(concat_in, concatTensorInfo);
97 armcomputetensorutils::InitialiseArmComputeTensorEmpty(splitter_out);
98 armcomputetensorutils::InitialiseArmComputeTensorEmpty(concat_in);
101 m_SplitterOutputsTensors.push_back(std::move(splitter_out));
102 m_ConcatInputsTensors.push_back(std::move(concat_in));
105 for (
unsigned int i = 0; i < maxTime; ++i)
108 m_SplitterOutputs.push_back(&m_SplitterOutputsTensors[i]);
109 m_ConcatInputs.push_back(&m_ConcatInputsTensors[i]);
115 unsigned int numberDimensions = 3;
116 unsigned int dimension = 0;
121 unsigned int splitterDimSizes[3] = {1, batchSize, inputSize};
122 for (
unsigned int outputIdx = 0u; outputIdx < maxTime; ++outputIdx)
124 splitterDesc.
SetViewOriginCoord(outputIdx, dimension, splitterDimSizes[dimension] * outputIdx);
125 for (
unsigned int dimIdx = 0u; dimIdx < numberDimensions; ++dimIdx)
127 splitterDesc.
SetViewSize(outputIdx, dimIdx, splitterDimSizes[dimIdx]);
131 std::set<unsigned int> splitAxis =
ComputeSplitAxis(splitterDesc, timeMajorShapeInput);
133 std::unique_ptr<arm_compute::NESplit> split_layer(
new arm_compute::NESplit());
136 if (!m_Data.m_Parameters.m_TimeMajor)
138 split_layer->configure(&m_PermuteFirstOut, m_SplitterOutputs, aclAxisSplit);
141 split_layer->configure(&input, m_SplitterOutputs, aclAxisSplit);
144 split_layer->prepare();
145 m_Splitter.reset(split_layer.release());
151 arm_compute::LSTMParams<arm_compute::ITensor> lstm_param;
164 m_InputToForgetWeightsTensor = std::make_unique<arm_compute::Tensor>();
165 BuildArmComputeTensor(*m_InputToForgetWeightsTensor, m_Data.m_InputToForgetWeights->GetTensorInfo());
167 m_InputToCellWeightsTensor = std::make_unique<arm_compute::Tensor>();
168 BuildArmComputeTensor(*m_InputToCellWeightsTensor, m_Data.m_InputToCellWeights->GetTensorInfo());
170 m_InputToOutputWeightsTensor = std::make_unique<arm_compute::Tensor>();
171 BuildArmComputeTensor(*m_InputToOutputWeightsTensor, m_Data.m_InputToOutputWeights->GetTensorInfo());
173 m_RecurrentToForgetWeightsTensor = std::make_unique<arm_compute::Tensor>();
174 BuildArmComputeTensor(*m_RecurrentToForgetWeightsTensor, m_Data.m_RecurrentToForgetWeights->GetTensorInfo());
176 m_RecurrentToCellWeightsTensor = std::make_unique<arm_compute::Tensor>();
177 BuildArmComputeTensor(*m_RecurrentToCellWeightsTensor, m_Data.m_RecurrentToCellWeights->GetTensorInfo());
179 m_RecurrentToOutputWeightsTensor = std::make_unique<arm_compute::Tensor>();
180 BuildArmComputeTensor(*m_RecurrentToOutputWeightsTensor, m_Data.m_RecurrentToOutputWeights->GetTensorInfo());
182 m_ForgetGateBiasTensor = std::make_unique<arm_compute::Tensor>();
183 BuildArmComputeTensor(*m_ForgetGateBiasTensor, m_Data.m_ForgetGateBias->GetTensorInfo());
185 m_CellBiasTensor = std::make_unique<arm_compute::Tensor>();
186 BuildArmComputeTensor(*m_CellBiasTensor, m_Data.m_CellBias->GetTensorInfo());
188 m_OutputGateBiasTensor = std::make_unique<arm_compute::Tensor>();
189 BuildArmComputeTensor(*m_OutputGateBiasTensor, m_Data.m_OutputGateBias->GetTensorInfo());
192 if (!m_Data.m_Parameters.m_CifgEnabled)
194 m_InputToInputWeightsTensor = std::make_unique<arm_compute::Tensor>();
195 BuildArmComputeTensor(*m_InputToInputWeightsTensor, m_Data.m_InputToInputWeights->GetTensorInfo());
197 m_RecurrentToInputWeightsTensor = std::make_unique<arm_compute::Tensor>();
198 BuildArmComputeTensor(*m_RecurrentToInputWeightsTensor, m_Data.m_RecurrentToInputWeights->GetTensorInfo());
200 m_CellToInputWeightsTensor = std::make_unique<arm_compute::Tensor>();
201 if (m_Data.m_CellToInputWeights !=
nullptr)
203 BuildArmComputeTensor(*m_CellToInputWeightsTensor, m_Data.m_CellToInputWeights->GetTensorInfo());
206 m_InputGateBiasTensor = std::make_unique<arm_compute::Tensor>();
207 BuildArmComputeTensor(*m_InputGateBiasTensor, m_Data.m_InputGateBias->GetTensorInfo());
208 lstm_param.set_cifg_params(m_InputToInputWeightsTensor.get(),
209 m_RecurrentToInputWeightsTensor.get(),
210 m_Data.m_CellToInputWeights ? m_CellToInputWeightsTensor.get() :
nullptr,
211 m_InputGateBiasTensor.get());
214 if (m_Data.m_Parameters.m_ProjectionEnabled)
216 m_ProjectionWeightsTensor = std::make_unique<arm_compute::Tensor>();
217 BuildArmComputeTensor(*m_ProjectionWeightsTensor, m_Data.m_ProjectionWeights->GetTensorInfo());
219 m_ProjectionBiasTensor = std::make_unique<arm_compute::Tensor>();
220 if (m_Data.m_ProjectionBias !=
nullptr)
222 BuildArmComputeTensor(*m_ProjectionBiasTensor, m_Data.m_ProjectionBias->GetTensorInfo());
225 lstm_param.set_projection_params(m_ProjectionWeightsTensor.get(),
226 m_Data.m_ProjectionBias ? m_ProjectionBiasTensor.get() :
nullptr);
229 if (m_Data.m_Parameters.m_PeepholeEnabled)
231 m_CellToForgetWeightsTensor = std::make_unique<arm_compute::Tensor>();
232 BuildArmComputeTensor(*m_CellToForgetWeightsTensor, m_Data.m_CellToForgetWeights->GetTensorInfo());
234 m_CellToOutputWeightsTensor = std::make_unique<arm_compute::Tensor>();
235 BuildArmComputeTensor(*m_CellToOutputWeightsTensor, m_Data.m_CellToOutputWeights->GetTensorInfo());
237 lstm_param.set_peephole_params(m_CellToForgetWeightsTensor.get(), m_CellToOutputWeightsTensor.get());
240 if (m_Data.m_Parameters.m_LayerNormEnabled)
242 m_InputLayerNormWeightsTensor = std::make_unique<arm_compute::Tensor>();
243 if (!m_Data.m_Parameters.m_CifgEnabled)
245 BuildArmComputeTensor(*m_InputLayerNormWeightsTensor, m_Data.m_InputLayerNormWeights->GetTensorInfo());
248 m_ForgetLayerNormWeightsTensor = std::make_unique<arm_compute::Tensor>();
249 BuildArmComputeTensor(*m_ForgetLayerNormWeightsTensor, m_Data.m_ForgetLayerNormWeights->GetTensorInfo());
251 m_CellLayerNormWeightsTensor = std::make_unique<arm_compute::Tensor>();
252 BuildArmComputeTensor(*m_CellLayerNormWeightsTensor, m_Data.m_CellLayerNormWeights->GetTensorInfo());
254 m_OutputLayerNormWeightsTensor = std::make_unique<arm_compute::Tensor>();
255 BuildArmComputeTensor(*m_OutputLayerNormWeightsTensor, m_Data.m_OutputLayerNormWeights->GetTensorInfo());
257 auto inputNormWeightTensor = m_Data.m_Parameters.m_CifgEnabled ? nullptr : m_InputLayerNormWeightsTensor.get();
258 lstm_param.set_layer_normalization_params(inputNormWeightTensor,
259 m_ForgetLayerNormWeightsTensor.get(),
260 m_CellLayerNormWeightsTensor.get(),
261 m_OutputLayerNormWeightsTensor.get());
264 for (
unsigned int i = 0; i != maxTime; ++i)
268 arm_compute::ITensor* outputLSTM;
269 arm_compute::ITensor* inputLSTM;
275 if (maxTime == 1 && m_Data.m_Parameters.m_TimeMajor)
280 TensorShape inputShapeShrink({inputShape[1], inputShape[2]});
281 TensorShape outputShapeShrink({outputShape[1], outputShape[2]});
283 auto acl_input_shape_shrink = BuildArmComputeTensorShape(inputShapeShrink);
284 auto acl_output_shape_shrink = BuildArmComputeTensorShape(outputShapeShrink);
286 input.info()->set_tensor_shape(acl_input_shape_shrink);
287 inputLSTM =
const_cast<arm_compute::ITensor*
>(&input);
289 output.info()->set_tensor_shape(acl_output_shape_shrink);
290 outputLSTM = &output;
296 else if (maxTime == 1 && !m_Data.m_Parameters.m_TimeMajor)
299 TensorShape inputShapeShrink({inputShape[1], inputShape[2]});
300 auto acl_input_shape_shrink = BuildArmComputeTensorShape(inputShapeShrink);
301 m_PermuteFirstOut.info()->set_tensor_shape(acl_input_shape_shrink);
302 inputLSTM = &m_PermuteFirstOut;
304 outputLSTM =
const_cast<arm_compute::ITensor*
>(m_ConcatInputs[i]);
309 inputLSTM = m_SplitterOutputs[i];
310 outputLSTM =
const_cast<arm_compute::ITensor*
>(m_ConcatInputs[i]);
313 std::unique_ptr<arm_compute::NEQLSTMLayer> lstm_layer(
new arm_compute::NEQLSTMLayer());
315 lstm_layer->configure(inputLSTM,
316 m_InputToForgetWeightsTensor.get(),
317 m_InputToCellWeightsTensor.get(),
318 m_InputToOutputWeightsTensor.get(),
319 m_RecurrentToForgetWeightsTensor.get(),
320 m_RecurrentToCellWeightsTensor.get(),
321 m_RecurrentToOutputWeightsTensor.get(),
322 m_ForgetGateBiasTensor.get(),
323 m_CellBiasTensor.get(),
324 m_OutputGateBiasTensor.get(),
332 m_Layers.emplace_back(std::move(lstm_layer));
345 if (!m_Data.m_Parameters.m_CifgEnabled)
349 if (m_Data.m_CellToInputWeights !=
nullptr)
356 if (m_Data.m_Parameters.m_ProjectionEnabled)
359 if (m_Data.m_ProjectionBias !=
nullptr)
365 if (m_Data.m_Parameters.m_PeepholeEnabled)
371 if (m_Data.m_Parameters.m_LayerNormEnabled)
373 if (!m_Data.m_Parameters.m_CifgEnabled)
384 for (uint32_t i = 0; i < m_Layers.size(); ++i)
386 m_Layers[i]->prepare();
395 TensorShape shapeExpandTimeMajor({1, shape[0], shape[1]});
396 TensorShape shapeExpandBatchMajor({shape[0], 1, shape[1]});
400 for (
unsigned int i = 0; i < maxTime; ++i)
402 m_ConcatInputs[i]->info()->set_tensor_shape(BuildArmComputeTensorShape(shapeExpandTimeMajor));
406 for (
unsigned int inputIdx = 0u; inputIdx < maxTime; ++inputIdx)
411 m_Concat.reset(
new arm_compute::NEConcatenateLayer());
414 if (!m_Data.m_Parameters.m_TimeMajor)
416 TensorInfo concatOutputTensorInfo = outputInfo;
417 concatOutputTensorInfo.
SetShape(timeMajorShapeOutput);
418 BuildArmComputeTensor(concat_out, concatOutputTensorInfo);
419 armcomputetensorutils::InitialiseArmComputeTensorEmpty(concat_out);
421 m_Concat->configure(m_ConcatInputs, &concat_out, aclAxisConcat);
425 m_Concat->configure(m_ConcatInputs, &output, aclAxisConcat);
434 if (!m_Data.m_Parameters.m_TimeMajor)
436 output.info()->set_tensor_shape(BuildArmComputeTensorShape(shapeExpandBatchMajor));
440 output.info()->set_tensor_shape(BuildArmComputeTensorShape(shapeExpandTimeMajor));
447 if (!m_Data.m_Parameters.m_TimeMajor)
450 std::unique_ptr<arm_compute::NEPermute> layer(
new arm_compute::NEPermute());
453 layer->configure(&concat_out, &output, arm_compute::PermutationVector(0U, 2U, 1U));
457 layer->configure(m_ConcatInputs[0], &output, arm_compute::PermutationVector(0U, 2U, 1U));
459 m_Permute2.reset(layer.release());
476 for (uint32_t i = 0; i < m_Layers.size(); ++i)
506 "Unidirectional Sequence LSTM layer validate status failed.");
509 unsigned int maxTime = descriptor.
m_TimeMajor ? inputLayerShape[0] : inputLayerShape[1];
510 unsigned int batchSize = descriptor.
m_TimeMajor ? inputLayerShape[1] : inputLayerShape[0];
511 unsigned int inputSize = inputLayerShape[2];
512 unsigned int outputSize = outputLayerShape[2];
514 const TensorShape timeMajorShapeInput({maxTime, batchSize, inputSize});
515 const TensorShape timeMajorShapeOutput({maxTime, batchSize, outputSize});
528 const arm_compute::TensorInfo aclInputInfo = armcomputetensorutils::BuildArmComputeTensorInfo(input);
529 const arm_compute::TensorInfo aclOutputInfo = armcomputetensorutils::BuildArmComputeTensorInfo(output);
535 arm_compute::TensorInfo aclPermuteOutInfo = armcomputetensorutils::BuildArmComputeTensorInfo(permuteOutInfo);
538 statusPermute1 = arm_compute::NEPermute::validate(&aclInputInfo,
540 arm_compute::PermutationVector(0U, 2U, 1U));
546 std::vector<arm_compute::TensorInfo> splitterOutputsTensorInfos;
547 std::vector<arm_compute::TensorInfo> concatInputsTensorInfos;
548 std::vector<arm_compute::ITensorInfo*> splitterOutputsTensorInfosPtr;
549 std::vector<const arm_compute::ITensorInfo*> concatInputsTensorInfosPtr;
550 splitterOutputsTensorInfos.reserve(maxTime);
551 concatInputsTensorInfos.reserve(maxTime);
552 for (
unsigned int i = 0; i < maxTime; ++i)
554 arm_compute::TensorInfo splitter_out;
555 arm_compute::TensorInfo concat_in;
559 splitterTensorInfo.SetShape({batchSize, inputSize});
560 concatTensorInfo.SetShape({batchSize, outputSize});
562 arm_compute::TensorInfo aclSplitterTensorInfo
563 = armcomputetensorutils::BuildArmComputeTensorInfo(splitterTensorInfo);
564 arm_compute::TensorInfo aclConcatTensorInfo
565 = armcomputetensorutils::BuildArmComputeTensorInfo(concatTensorInfo);
567 splitterOutputsTensorInfos.emplace_back(aclSplitterTensorInfo);
568 concatInputsTensorInfos.emplace_back(aclConcatTensorInfo);
569 splitterOutputsTensorInfosPtr.emplace_back(&splitterOutputsTensorInfos[i]);
570 concatInputsTensorInfosPtr.emplace_back(&concatInputsTensorInfos[i]);
576 unsigned int numberDimensions = 3;
577 unsigned int dimension = 0;
578 unsigned int aclAxisSplit = CalcAclAxis(numberDimensions, dimension);
584 statusSplit = arm_compute::NESplit::validate(&aclPermuteOutInfo,
585 splitterOutputsTensorInfosPtr,
589 statusSplit = arm_compute::NESplit::validate(&aclInputInfo, splitterOutputsTensorInfosPtr, aclAxisSplit);
597 arm_compute::LSTMParams<arm_compute::ITensorInfo> lstm_params_info;
599 unsigned int numUnits = cellStateIn.
GetShape()[1];
600 unsigned int scratchBufferFactor = 4;
605 scratchBufferFactor = 3;
614 const arm_compute::TensorInfo aclOutputStateInInfo = BuildArmComputeTensorInfo(outputStateIn);
615 const arm_compute::TensorInfo aclCellStateInInfo = BuildArmComputeTensorInfo(cellStateIn);
616 const arm_compute::TensorInfo aclScratchBufferInfo = BuildArmComputeTensorInfo(scratchBuffer);
617 const arm_compute::TensorInfo aclOutputStateOutInfo = BuildArmComputeTensorInfo(outputStateOut);
618 const arm_compute::TensorInfo aclCellStateOutInfo = BuildArmComputeTensorInfo(cellStateOut);
621 const arm_compute::TensorInfo aclInputToForgetWeightsInfo
623 const arm_compute::TensorInfo aclInputToCellWeightsInfo
625 const arm_compute::TensorInfo aclInputToOutputWeightsInfo
627 const arm_compute::TensorInfo aclRecurrentToForgetWeightsInfo
629 const arm_compute::TensorInfo aclRecurrentToCellWeightsInfo
631 const arm_compute::TensorInfo aclRecurrentToOutputWeightsInfo
633 const arm_compute::TensorInfo aclForgetGateBiasInfo
635 const arm_compute::TensorInfo aclCellBiasInfo
636 = BuildArmComputeTensorInfo(paramsInfo.
GetCellBias());
637 const arm_compute::TensorInfo aclOutputGateBiasInfo
640 arm_compute::TensorInfo aclInputToInputWeightsInfo;
641 arm_compute::TensorInfo aclRecurrentToInputWeightsInfo;
642 arm_compute::TensorInfo aclCellToInputWeightsInfo;
643 arm_compute::TensorInfo aclInputGateBiasInfo;
644 arm_compute::TensorInfo aclProjectionWeightsInfo;
645 arm_compute::TensorInfo aclProjectionBiasInfo;
646 arm_compute::TensorInfo aclCellToForgetWeightsInfo;
647 arm_compute::TensorInfo aclCellToOutputWeightsInfo;
649 arm_compute::TensorInfo aclInputLayerNormWeightsInfo;
650 arm_compute::TensorInfo aclForgetLayerNormWeightsInfo;
651 arm_compute::TensorInfo aclCellLayerNormWeightsInfo;
652 arm_compute::TensorInfo aclOutputLayerNormWeightsInfo;
662 aclInputGateBiasInfo = BuildArmComputeTensorInfo(paramsInfo.
GetInputGateBias());
664 lstm_params_info.set_cifg_params(&aclInputToInputWeightsInfo,
665 &aclRecurrentToInputWeightsInfo,
667 &aclInputGateBiasInfo);
674 aclProjectionBiasInfo = BuildArmComputeTensorInfo(paramsInfo.
GetProjectionBias());
678 lstm_params_info.set_projection_params(&aclProjectionWeightsInfo,
687 lstm_params_info.set_peephole_params(&aclCellToForgetWeightsInfo, &aclCellToOutputWeightsInfo);
700 lstm_params_info.set_layer_normalization_params(descriptor.
m_CifgEnabled ?
nullptr :
701 &aclInputLayerNormWeightsInfo,
702 &aclForgetLayerNormWeightsInfo,
703 &aclCellLayerNormWeightsInfo,
704 &aclOutputLayerNormWeightsInfo);
714 for (
unsigned int i = 0; i != maxTime; ++i)
719 arm_compute::ITensorInfo* outputLSTM;
720 arm_compute::ITensorInfo* inputLSTM;
731 TensorShape inputShapeShrink({inputShape[1], inputShape[2]});
732 TensorShape outputShapeShrink({outputShape[1], outputShape[2]});
734 auto acl_input_shape_shrink = BuildArmComputeTensorShape(inputShapeShrink);
735 auto acl_output_shape_shrink = BuildArmComputeTensorShape(outputShapeShrink);
737 const_cast<arm_compute::TensorInfo*
>(&aclInputInfo)->set_tensor_shape(acl_input_shape_shrink);
738 inputLSTM =
const_cast<arm_compute::TensorInfo*
>(&aclInputInfo);
740 const_cast<arm_compute::TensorInfo*
>(&aclOutputInfo)->set_tensor_shape(acl_output_shape_shrink);
741 outputLSTM =
const_cast<arm_compute::TensorInfo*
>(&aclOutputInfo);
750 TensorShape inputShapeShrink({inputShape[1], inputShape[2]});
751 auto acl_input_shape_shrink = BuildArmComputeTensorShape(inputShapeShrink);
752 aclPermuteOutInfo.set_tensor_shape(acl_input_shape_shrink);
753 inputLSTM = &aclPermuteOutInfo;
755 outputLSTM =
const_cast<arm_compute::ITensorInfo*
>(concatInputsTensorInfosPtr[i]);
760 inputLSTM = splitterOutputsTensorInfosPtr[i];
761 outputLSTM =
const_cast<arm_compute::ITensorInfo*
>(concatInputsTensorInfosPtr[i]);
764 statusLSTM = arm_compute::NEQLSTMLayer::validate(inputLSTM,
765 &aclInputToForgetWeightsInfo,
766 &aclInputToCellWeightsInfo,
767 &aclInputToOutputWeightsInfo,
768 &aclRecurrentToForgetWeightsInfo,
769 &aclRecurrentToCellWeightsInfo,
770 &aclRecurrentToOutputWeightsInfo,
771 &aclForgetGateBiasInfo,
773 &aclOutputGateBiasInfo,
775 &aclOutputStateInInfo,
776 &aclCellStateOutInfo,
777 &aclOutputStateOutInfo,
788 TensorShape shapeExpandTimeMajor({1, shape[0], shape[1]});
789 TensorShape shapeExpandBatchMajor({shape[0], 1, shape[1]});
792 concatOutputTensorInfo.SetShape(timeMajorShapeOutput);
793 arm_compute::TensorInfo aclConcatOutputTensorInfo= BuildArmComputeTensorInfo(concatOutputTensorInfo);
797 for (
unsigned int i = 0; i < maxTime; ++i)
799 auto acl_shape_expand = BuildArmComputeTensorShape(shapeExpandTimeMajor);
800 concatInputsTensorInfos[i].set_tensor_shape(acl_shape_expand);
803 unsigned int aclAxisConcat = CalcAclAxis(numberDimensions, dimension);
806 statusConcat = arm_compute::NEConcatenateLayer::validate(concatInputsTensorInfosPtr,
807 &aclConcatOutputTensorInfo,
812 statusConcat = arm_compute::NEConcatenateLayer::validate(concatInputsTensorInfosPtr,
823 const_cast<arm_compute::TensorInfo*
>(&aclInputInfo)->set_tensor_shape(
824 BuildArmComputeTensorShape(shapeExpandBatchMajor));
828 const_cast<arm_compute::TensorInfo*
>(&aclInputInfo)->set_tensor_shape(
829 BuildArmComputeTensorShape(shapeExpandTimeMajor));
841 statusPermute2 = arm_compute::NEPermute::validate(&aclConcatOutputTensorInfo,
843 arm_compute::PermutationVector(0U, 2U, 1U));
847 statusPermute2 = arm_compute::NEPermute::validate(concatInputsTensorInfosPtr[0],
849 arm_compute::PermutationVector(0U, 2U, 1U));
853 auto okCode = arm_compute::ErrorCode::OK;
854 if (statusPermute1.error_code() == okCode &&
855 statusSplit.error_code() == okCode &&
856 statusLSTM .error_code() == okCode &&
857 statusConcat.error_code() == okCode &&
858 statusPermute2.error_code() == okCode)
861 "All Unidirectional Sequence LSTM layer validate status OK.");
866 "Unidirectional Sequence LSTM layer validate status failed.");
870 void NeonUnidirectionalSequenceLstmWorkload::FreeUnusedTensors()
872 FreeTensorIfUnused(m_InputToInputWeightsTensor);
873 FreeTensorIfUnused(m_InputToForgetWeightsTensor);
874 FreeTensorIfUnused(m_InputToCellWeightsTensor);
875 FreeTensorIfUnused(m_InputToOutputWeightsTensor);
876 FreeTensorIfUnused(m_RecurrentToInputWeightsTensor);
877 FreeTensorIfUnused(m_RecurrentToForgetWeightsTensor);
878 FreeTensorIfUnused(m_RecurrentToCellWeightsTensor);
879 FreeTensorIfUnused(m_RecurrentToOutputWeightsTensor);
880 FreeTensorIfUnused(m_CellToInputWeightsTensor);
881 FreeTensorIfUnused(m_CellToForgetWeightsTensor);
882 FreeTensorIfUnused(m_CellToOutputWeightsTensor);
883 FreeTensorIfUnused(m_InputGateBiasTensor);
884 FreeTensorIfUnused(m_ForgetGateBiasTensor);
885 FreeTensorIfUnused(m_CellBiasTensor);
886 FreeTensorIfUnused(m_OutputGateBiasTensor);
887 FreeTensorIfUnused(m_ProjectionWeightsTensor);
888 FreeTensorIfUnused(m_ProjectionBiasTensor);
889 FreeTensorIfUnused(m_InputLayerNormWeightsTensor);
890 FreeTensorIfUnused(m_ForgetLayerNormWeightsTensor);
891 FreeTensorIfUnused(m_CellLayerNormWeightsTensor);
892 FreeTensorIfUnused(m_OutputLayerNormWeightsTensor);