Fix ShimDevice::allocate, wrong operand used for output role.
Bug: 210970637
Test: cts
Change-Id: I76d5b89e2d95d4e775ca544c54ec5100e404ba47
Merged-In: I76d5b89e2d95d4e775ca544c54ec5100e404ba47
(cherry picked from commit b5c6b2dca691228341b20e2ac39c1c7e975d954e)
diff --git a/shim_and_sl/ShimDevice.cpp b/shim_and_sl/ShimDevice.cpp
index 06e18d7..eadbbef 100644
--- a/shim_and_sl/ShimDevice.cpp
+++ b/shim_and_sl/ShimDevice.cpp
@@ -416,7 +416,7 @@
"ShimDriver::allocate -- ANeuralNetworksMemoryDesc_addInputRole fail");
}
const auto& model = pmodel->getMainModel();
- const auto& op = model.getOperands()[model.getInputs()[role.ioIndex]];
+ const auto& op = model.getOperands()[model.getOutputs()[role.ioIndex]];
auto operandType = static_cast<::android::nn::OperandType>(op.operandType.type);
if (!type) {
type = operandType;