Exclude unused operands from removeOperandTest
Bug: 148208229
Test: TestGenerated/ValidationTest.Test/nnapi_sample*_while*_unused_output*
Change-Id: I39bebefd0e40d370882d614d4beb97ab36c9da8f
Merged-In: I39bebefd0e40d370882d614d4beb97ab36c9da8f
(cherry picked from commit baa4cf02f2
)
This commit is contained in:
parent
d05127d16d
commit
af1c77d74f
1 changed files with 10 additions and 5 deletions
|
@ -535,13 +535,18 @@ static void removeOperand(Model* model, uint32_t index) {
|
||||||
removeValueAndDecrementGreaterValues(&model->main.outputIndexes, index);
|
removeValueAndDecrementGreaterValues(&model->main.outputIndexes, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool removeOperandSkip(size_t operand, const Model& model) {
|
static bool removeOperandSkip(size_t operandIndex, const Model& model) {
|
||||||
|
const Operand& operand = model.main.operands[operandIndex];
|
||||||
|
if (operand.numberOfConsumers == 0) {
|
||||||
|
// Removing an unused operand has no effect.
|
||||||
|
return true;
|
||||||
|
}
|
||||||
for (const Operation& operation : model.main.operations) {
|
for (const Operation& operation : model.main.operations) {
|
||||||
// Skip removeOperandTest for the following operations.
|
// Skip removeOperandTest for the following operations.
|
||||||
// - SPLIT's outputs are not checked during prepareModel.
|
// - SPLIT's outputs are not checked during prepareModel.
|
||||||
if (operation.type == OperationType::SPLIT) {
|
if (operation.type == OperationType::SPLIT) {
|
||||||
for (const size_t outOprand : operation.outputs) {
|
for (const size_t index : operation.outputs) {
|
||||||
if (operand == outOprand) {
|
if (index == operandIndex) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -556,8 +561,8 @@ static bool removeOperandSkip(size_t operand, const Model& model) {
|
||||||
operation.type == OperationType::UNIDIRECTIONAL_SEQUENCE_RNN ||
|
operation.type == OperationType::UNIDIRECTIONAL_SEQUENCE_RNN ||
|
||||||
operation.type == OperationType::BIDIRECTIONAL_SEQUENCE_LSTM ||
|
operation.type == OperationType::BIDIRECTIONAL_SEQUENCE_LSTM ||
|
||||||
operation.type == OperationType::BIDIRECTIONAL_SEQUENCE_RNN) {
|
operation.type == OperationType::BIDIRECTIONAL_SEQUENCE_RNN) {
|
||||||
for (const size_t outOprand : operation.outputs) {
|
for (const size_t index : operation.outputs) {
|
||||||
if (operand == outOprand) {
|
if (index == operandIndex) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue