diff options
author | Mike Kelly <mike.kelly@arm.com> | 2022-04-25 16:18:57 +0100 |
---|---|---|
committer | mike.kelly <mike.kelly@arm.com> | 2022-05-04 15:45:44 +0000 |
commit | 0ae102a0fc9d66b7067cf8d7a0ed1af5ed65ae50 (patch) | |
tree | 106e684da730f0eb9b3f29922af2244c26f2e528 /test | |
parent | be9d99e354b54ecf50578478203a86efa5442789 (diff) | |
download | android-nn-driver-0ae102a0fc9d66b7067cf8d7a0ed1af5ed65ae50.tar.gz |
IVGCVSW-6806 Fixed issue with missing TensorInfos in UnidirectionalSequenceLSTM
* Corrected TensorInfo order for IsUnidirectionalSequenceLstmSupported
* outputStateOut TensorInfo is not optional.
* cellStateOut TensorInfo is not optional.
* TensorInfo Order matches other QLSTM/LSTM layers.
!armnn:7455
Signed-off-by: Mike Kelly <mike.kelly@arm.com>
Change-Id: I5b0e0fa4b6e1c3da6689d9aefc9b959172c2e7d4
Diffstat (limited to 'test')
-rw-r--r-- | test/UnidirectionalSequenceLstm.hpp | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/test/UnidirectionalSequenceLstm.hpp b/test/UnidirectionalSequenceLstm.hpp index d03f8ab3..75b7a8d4 100644 --- a/test/UnidirectionalSequenceLstm.hpp +++ b/test/UnidirectionalSequenceLstm.hpp @@ -138,10 +138,10 @@ void UnidirectionalSequenceLstmTestImpl(const hidl_vec<uint32_t>& inputDimension const std::vector<float>& outputLayerNormWeightsValue, const hidl_vec<uint32_t>& outputDimensions, const std::vector<float>& outputValue, - const hidl_vec<uint32_t>&, - const std::vector<float>&, - const hidl_vec<uint32_t>&, - const std::vector<float>&, + const hidl_vec<uint32_t>&, // outputStateOutDimensions, + const std::vector<float>&, // outputStateOutValue, + const hidl_vec<uint32_t>&, // cellStateOutDimensions, + const std::vector<float>&, // cellStateOutValue, armnn::Compute compute, float epsilonValue = 0) { @@ -519,12 +519,12 @@ void UnidirectionalSequenceLstmLayerFloat32TestImpl(armnn::Compute compute) // 1: The hidden state (out): A 2-D tensor of ANEURALNETWORKS_TENSOR_FLOAT32/16, of shape // [batch_size, output_size]. This output is optional and can be omitted. If this output // is present then output #2 must be present as well. - hidl_vec<uint32_t> hiddenStateOutDimensions{0}; - std::vector<float> hiddenStateOutValue; + hidl_vec<uint32_t> hiddenStateOutDimensions{batchSize, outputSize}; + std::vector<float> hiddenStateOutValue(batchSize * outputSize, 0.f); // 2: The cell state (out): A 2-D tensor of ANEURALNETWORKS_TENSOR_FLOAT32/16, of shape // [batch_size, num_units]. This output is optional and can be omitted. - hidl_vec<uint32_t> cellStateOutDimensions{0}; - std::vector<float> cellStateOutValue; + hidl_vec<uint32_t> cellStateOutDimensions{batchSize, numUnits}; + std::vector<float> cellStateOutValue(batchSize * numUnits, 0.f); UnidirectionalSequenceLstmTestImpl<HalPolicy>(inputDimensions, inputValue, inputToInputWeightsDimensions, inputToInputWeightsValue, @@ -724,12 +724,12 @@ void UnidirectionalSequenceLstmLayerFloat32TimeMajorTestImpl(armnn::Compute comp // 1: The hidden state (out): A 2-D tensor of ANEURALNETWORKS_TENSOR_FLOAT32/16, of shape // [batch_size, output_size]. This output is optional and can be omitted. If this output // is present then output #2 must be present as well. - hidl_vec<uint32_t> hiddenStateOutDimensions{0}; - std::vector<float> hiddenStateOutValue; + hidl_vec<uint32_t> hiddenStateOutDimensions{batchSize, outputSize}; + std::vector<float> hiddenStateOutValue(batchSize * outputSize, 0.f); // 2: The cell state (out): A 2-D tensor of ANEURALNETWORKS_TENSOR_FLOAT32/16, of shape // [batch_size, num_units]. This output is optional and can be omitted. - hidl_vec<uint32_t> cellStateOutDimensions{0}; - std::vector<float> cellStateOutValue; + hidl_vec<uint32_t> cellStateOutDimensions{batchSize, numUnits}; + std::vector<float> cellStateOutValue(batchSize * numUnits, 0.f); UnidirectionalSequenceLstmTestImpl<HalPolicy>(inputDimensions, inputValue, inputToInputWeightsDimensions, inputToInputWeightsValue, @@ -964,12 +964,12 @@ void UnidirectionalSequenceLstmLayerNoCifgWithPeepholeWithProjectionTestImpl(arm // 1: The hidden state (out): A 2-D tensor of ANEURALNETWORKS_TENSOR_FLOAT32/16, of shape // [batch_size, output_size]. This output is optional and can be omitted. If this output // is present then output #2 must be present as well. - hidl_vec<uint32_t> hiddenStateOutDimensions{0}; - std::vector<float> hiddenStateOutValue; + hidl_vec<uint32_t> hiddenStateOutDimensions{batchSize, outputSize}; + std::vector<float> hiddenStateOutValue(batchSize * outputSize, 0.f); // 2: The cell state (out): A 2-D tensor of ANEURALNETWORKS_TENSOR_FLOAT32/16, of shape // [batch_size, num_units]. This output is optional and can be omitted. - hidl_vec<uint32_t> cellStateOutDimensions{0}; - std::vector<float> cellStateOutValue; + hidl_vec<uint32_t> cellStateOutDimensions{batchSize, numUnits}; + std::vector<float> cellStateOutValue(batchSize * numUnits, 0.f); UnidirectionalSequenceLstmTestImpl<HalPolicy>(inputDimensions, inputValue, inputToInputWeightsDimensions, inputToInputWeightsValue, @@ -1179,12 +1179,12 @@ void UnidirectionalSequenceLstmLayerNoCifgWithPeepholeWithProjectionWithLayerNor // 1: The hidden state (out): A 2-D tensor of ANEURALNETWORKS_TENSOR_FLOAT32/16, of shape // [batch_size, output_size]. This output is optional and can be omitted. If this output // is present then output #2 must be present as well. - hidl_vec<uint32_t> hiddenStateOutDimensions{0}; - std::vector<float> hiddenStateOutValue; + hidl_vec<uint32_t> hiddenStateOutDimensions{batchSize, outputSize}; + std::vector<float> hiddenStateOutValue(batchSize * outputSize, 0.f); // 2: The cell state (out): A 2-D tensor of ANEURALNETWORKS_TENSOR_FLOAT32/16, of shape // [batch_size, num_units]. This output is optional and can be omitted. - hidl_vec<uint32_t> cellStateOutDimensions{0}; - std::vector<float> cellStateOutValue; + hidl_vec<uint32_t> cellStateOutDimensions{batchSize, numUnits}; + std::vector<float> cellStateOutValue(batchSize * numUnits, 0.f); UnidirectionalSequenceLstmTestImpl<HalPolicy>(inputDimensions, inputValue, inputToInputWeightsDimensions, inputToInputWeightsValue, @@ -1376,12 +1376,12 @@ void UnidirectionalSequenceLstmWithCifgWithPeepholeNoProjectionTestImpl(armnn::C // 1: The hidden state (out): A 2-D tensor of ANEURALNETWORKS_TENSOR_FLOAT32/16, of shape // [batch_size, output_size]. This output is optional and can be omitted. If this output // is present then output #2 must be present as well. - hidl_vec<uint32_t> hiddenStateOutDimensions{0}; - std::vector<float> hiddenStateOutValue; + hidl_vec<uint32_t> hiddenStateOutDimensions{batchSize, outputSize}; + std::vector<float> hiddenStateOutValue(batchSize * outputSize, 0.f); // 2: The cell state (out): A 2-D tensor of ANEURALNETWORKS_TENSOR_FLOAT32/16, of shape // [batch_size, num_units]. This output is optional and can be omitted. - hidl_vec<uint32_t> cellStateOutDimensions{0}; - std::vector<float> cellStateOutValue; + hidl_vec<uint32_t> cellStateOutDimensions{batchSize, numUnits}; + std::vector<float> cellStateOutValue(batchSize * numUnits, 0.f); UnidirectionalSequenceLstmTestImpl<HalPolicy>(inputDimensions, inputValue, inputToInputWeightsDimensions, inputToInputWeightsValue, |