Allow BATCH_MATMUL with different input and output scales.
The CPU reference implementation already supported this, so the only
change needed is to relax the validation and modify the test.
Also updated sample shim driver prebuilts.
Cherrypicked from I4513c2c73d6d920378e32ee8491bb642796a386d
Bug: 206089870
Test: NNT_static
Test: VtsHalNeuralnetworksTargetTest
Change-Id: I4513c2c73d6d920378e32ee8491bb642796a386d
diff --git a/common/operations/BatchMatmul.cpp b/common/operations/BatchMatmul.cpp
index 07e938b..debed06 100644
--- a/common/operations/BatchMatmul.cpp
+++ b/common/operations/BatchMatmul.cpp
@@ -26,6 +26,8 @@
#pragma clang diagnostic pop
#include <limits>
+#include <memory>
+#include <vector>
#include "CpuOperationUtils.h"
#endif // NN_INCLUDE_CPU_IMPLEMENTATION
@@ -69,16 +71,16 @@
return LHSCol == RHSRow;
}
-// Computes the shape of output tensor.
-Shape computeOutputShape(const Shape& LHSTensorShape, const Shape& RHSTensorShape, bool adjX,
- bool adjY) {
+// Computes the dimensions of output tensor.
+std::vector<uint32_t> computeOutputDimensions(const Shape& LHSTensorShape,
+ const Shape& RHSTensorShape, bool adjX, bool adjY) {
uint32_t numDims = getNumberOfDimensions(LHSTensorShape);
- Shape outputTensorShape = LHSTensorShape;
- outputTensorShape.dimensions[numDims - 2] =
+ auto outputTensorDimensions = LHSTensorShape.dimensions;
+ outputTensorDimensions[numDims - 2] =
adjX ? LHSTensorShape.dimensions[numDims - 1] : LHSTensorShape.dimensions[numDims - 2];
- outputTensorShape.dimensions[numDims - 1] =
+ outputTensorDimensions[numDims - 1] =
adjY ? RHSTensorShape.dimensions[numDims - 2] : RHSTensorShape.dimensions[numDims - 1];
- return outputTensorShape;
+ return outputTensorDimensions;
}
// Swaps row and column dimensions for a shape.
@@ -262,9 +264,10 @@
getSizeOfDimension(inputRHSTensorShape, numDims - 1), adjX, adjY))
<< "Input tensors are not able to perform matrix multiplication.";
- return context->setOutputShape(
- kOutputTensor,
- computeOutputShape(inputLHSTensorShape, inputRHSTensorShape, adjX, adjY));
+ Shape outputTensorShape = context->getOutputShape(kOutputTensor);
+ outputTensorShape.dimensions =
+ computeOutputDimensions(inputLHSTensorShape, inputRHSTensorShape, adjX, adjY);
+ return context->setOutputShape(kOutputTensor, outputTensorShape);
}
bool execute(IOperationExecutionContext* context) {
@@ -318,4 +321,4 @@
batch_matmul_op::prepare, batch_matmul_op::execute);
} // namespace nn
-} // namespace android
\ No newline at end of file
+} // namespace android
diff --git a/driver/sample_shim/android_arm/neuralnetworks_sample_sl_driver_prebuilt.so b/driver/sample_shim/android_arm/neuralnetworks_sample_sl_driver_prebuilt.so
index 7c597b6..c9eed54 100755
--- a/driver/sample_shim/android_arm/neuralnetworks_sample_sl_driver_prebuilt.so
+++ b/driver/sample_shim/android_arm/neuralnetworks_sample_sl_driver_prebuilt.so
Binary files differ
diff --git a/driver/sample_shim/android_arm64/neuralnetworks_sample_sl_driver_prebuilt.so b/driver/sample_shim/android_arm64/neuralnetworks_sample_sl_driver_prebuilt.so
index 779817a..30d5e9b 100755
--- a/driver/sample_shim/android_arm64/neuralnetworks_sample_sl_driver_prebuilt.so
+++ b/driver/sample_shim/android_arm64/neuralnetworks_sample_sl_driver_prebuilt.so
Binary files differ
diff --git a/driver/sample_shim/android_x86/neuralnetworks_sample_sl_driver_prebuilt.so b/driver/sample_shim/android_x86/neuralnetworks_sample_sl_driver_prebuilt.so
index f87707e..4b31162 100755
--- a/driver/sample_shim/android_x86/neuralnetworks_sample_sl_driver_prebuilt.so
+++ b/driver/sample_shim/android_x86/neuralnetworks_sample_sl_driver_prebuilt.so
Binary files differ
diff --git a/driver/sample_shim/android_x86_64/neuralnetworks_sample_sl_driver_prebuilt.so b/driver/sample_shim/android_x86_64/neuralnetworks_sample_sl_driver_prebuilt.so
index d56ddfd..7245626 100755
--- a/driver/sample_shim/android_x86_64/neuralnetworks_sample_sl_driver_prebuilt.so
+++ b/driver/sample_shim/android_x86_64/neuralnetworks_sample_sl_driver_prebuilt.so
Binary files differ
diff --git a/runtime/test/generated/spec_AIDL_V2/batch_matmul.example.cpp b/runtime/test/generated/spec_AIDL_V2/batch_matmul.example.cpp
index dbcef1e..cb01958 100644
--- a/runtime/test/generated/spec_AIDL_V2/batch_matmul.example.cpp
+++ b/runtime/test/generated/spec_AIDL_V2/batch_matmul.example.cpp
@@ -536,24 +536,24 @@
.inputIndexes = {0, 1},
.operands = {{ // op1
.channelQuant = {},
- .data = TestBuffer::createFromVector<int8_t>({-127, -126, -125, -124, -123, -122}),
+ .data = TestBuffer::createFromVector<int8_t>({4, 8, 12, 16, 20, 24}),
.dimensions = {1, 2, 3},
.isIgnored = false,
.lifetime = TestOperandLifeTime::SUBGRAPH_INPUT,
.numberOfConsumers = 1,
- .scale = 1.0f,
+ .scale = 0.25f,
.type = TestOperandType::TENSOR_QUANT8_ASYMM_SIGNED,
- .zeroPoint = -128
+ .zeroPoint = 0
}, { // op2
.channelQuant = {},
- .data = TestBuffer::createFromVector<int8_t>({-121, -120, -119, -118, -117, -116, -115, -114, -113, -112, -111, -110}),
+ .data = TestBuffer::createFromVector<int8_t>({-50, -48, -46, -44, -42, -40, -38, -36, -34, -32, -30, -28}),
.dimensions = {1, 3, 4},
.isIgnored = false,
.lifetime = TestOperandLifeTime::SUBGRAPH_INPUT,
.numberOfConsumers = 1,
- .scale = 1.0f,
+ .scale = 0.5f,
.type = TestOperandType::TENSOR_QUANT8_ASYMM_SIGNED,
- .zeroPoint = -128
+ .zeroPoint = -64
}, { // adj0
.channelQuant = {},
.data = TestBuffer::createFromVector<bool8>({false}),
@@ -618,9 +618,9 @@
.isIgnored = false,
.lifetime = TestOperandLifeTime::TEMPORARY_VARIABLE,
.numberOfConsumers = 1,
- .scale = 1.0f,
+ .scale = 0.25f,
.type = TestOperandType::TENSOR_QUANT8_ASYMM_SIGNED,
- .zeroPoint = -128
+ .zeroPoint = 0
}, { // op2
.channelQuant = {},
.data = TestBuffer::createFromVector<int8_t>({}),
@@ -628,9 +628,9 @@
.isIgnored = false,
.lifetime = TestOperandLifeTime::TEMPORARY_VARIABLE,
.numberOfConsumers = 1,
- .scale = 1.0f,
+ .scale = 0.5f,
.type = TestOperandType::TENSOR_QUANT8_ASYMM_SIGNED,
- .zeroPoint = -128
+ .zeroPoint = -64
}, { // adj0
.channelQuant = {},
.data = TestBuffer::createFromVector<bool8>({false}),
@@ -663,24 +663,24 @@
.zeroPoint = -128
}, { // op1_new
.channelQuant = {},
- .data = TestBuffer::createFromVector<int8_t>({-127, -126, -125, -124, -123, -122}),
+ .data = TestBuffer::createFromVector<int8_t>({4, 8, 12, 16, 20, 24}),
.dimensions = {1, 2, 3},
.isIgnored = false,
.lifetime = TestOperandLifeTime::SUBGRAPH_INPUT,
.numberOfConsumers = 1,
- .scale = 1.0f,
+ .scale = 0.25f,
.type = TestOperandType::TENSOR_QUANT8_ASYMM_SIGNED,
- .zeroPoint = -128
+ .zeroPoint = 0
}, { // placeholder4
.channelQuant = {},
- .data = TestBuffer::createFromVector<int8_t>({-128}),
+ .data = TestBuffer::createFromVector<int8_t>({0}),
.dimensions = {1},
.isIgnored = false,
.lifetime = TestOperandLifeTime::CONSTANT_COPY,
.numberOfConsumers = 1,
- .scale = 1.0f,
+ .scale = 0.25f,
.type = TestOperandType::TENSOR_QUANT8_ASYMM_SIGNED,
- .zeroPoint = -128
+ .zeroPoint = 0
}, { // param4
.channelQuant = {},
.data = TestBuffer::createFromVector<int32_t>({0}),
@@ -693,24 +693,24 @@
.zeroPoint = 0
}, { // op2_new
.channelQuant = {},
- .data = TestBuffer::createFromVector<int8_t>({-121, -120, -119, -118, -117, -116, -115, -114, -113, -112, -111, -110}),
+ .data = TestBuffer::createFromVector<int8_t>({-50, -48, -46, -44, -42, -40, -38, -36, -34, -32, -30, -28}),
.dimensions = {1, 3, 4},
.isIgnored = false,
.lifetime = TestOperandLifeTime::SUBGRAPH_INPUT,
.numberOfConsumers = 1,
- .scale = 1.0f,
+ .scale = 0.5f,
.type = TestOperandType::TENSOR_QUANT8_ASYMM_SIGNED,
- .zeroPoint = -128
+ .zeroPoint = -64
}, { // placeholder5
.channelQuant = {},
- .data = TestBuffer::createFromVector<int8_t>({-128}),
+ .data = TestBuffer::createFromVector<int8_t>({-64}),
.dimensions = {1},
.isIgnored = false,
.lifetime = TestOperandLifeTime::CONSTANT_COPY,
.numberOfConsumers = 1,
- .scale = 1.0f,
+ .scale = 0.5f,
.type = TestOperandType::TENSOR_QUANT8_ASYMM_SIGNED,
- .zeroPoint = -128
+ .zeroPoint = -64
}, { // param5
.channelQuant = {},
.data = TestBuffer::createFromVector<int32_t>({0}),
@@ -1279,24 +1279,24 @@
.inputIndexes = {0, 1},
.operands = {{ // op11
.channelQuant = {},
- .data = TestBuffer::createFromVector<int8_t>({-127, -126, -125, -124, -123, -122}),
+ .data = TestBuffer::createFromVector<int8_t>({4, 8, 12, 16, 20, 24}),
.dimensions = {1, 2, 3},
.isIgnored = false,
.lifetime = TestOperandLifeTime::SUBGRAPH_INPUT,
.numberOfConsumers = 1,
- .scale = 1.0f,
+ .scale = 0.25f,
.type = TestOperandType::TENSOR_QUANT8_ASYMM_SIGNED,
- .zeroPoint = -128
+ .zeroPoint = 0
}, { // op21
.channelQuant = {},
- .data = TestBuffer::createFromVector<int8_t>({-121, -117, -113, -120, -116, -112, -119, -115, -111, -118, -114, -110}),
+ .data = TestBuffer::createFromVector<int8_t>({-50, -42, -34, -48, -40, -32, -46, -38, -30, -44, -36, -28}),
.dimensions = {1, 4, 3},
.isIgnored = false,
.lifetime = TestOperandLifeTime::SUBGRAPH_INPUT,
.numberOfConsumers = 1,
- .scale = 1.0f,
+ .scale = 0.5f,
.type = TestOperandType::TENSOR_QUANT8_ASYMM_SIGNED,
- .zeroPoint = -128
+ .zeroPoint = -64
}, { // adj01
.channelQuant = {},
.data = TestBuffer::createFromVector<bool8>({false}),
@@ -1361,9 +1361,9 @@
.isIgnored = false,
.lifetime = TestOperandLifeTime::TEMPORARY_VARIABLE,
.numberOfConsumers = 1,
- .scale = 1.0f,
+ .scale = 0.25f,
.type = TestOperandType::TENSOR_QUANT8_ASYMM_SIGNED,
- .zeroPoint = -128
+ .zeroPoint = 0
}, { // op21
.channelQuant = {},
.data = TestBuffer::createFromVector<int8_t>({}),
@@ -1371,9 +1371,9 @@
.isIgnored = false,
.lifetime = TestOperandLifeTime::TEMPORARY_VARIABLE,
.numberOfConsumers = 1,
- .scale = 1.0f,
+ .scale = 0.5f,
.type = TestOperandType::TENSOR_QUANT8_ASYMM_SIGNED,
- .zeroPoint = -128
+ .zeroPoint = -64
}, { // adj01
.channelQuant = {},
.data = TestBuffer::createFromVector<bool8>({false}),
@@ -1406,24 +1406,24 @@
.zeroPoint = -128
}, { // op11_new
.channelQuant = {},
- .data = TestBuffer::createFromVector<int8_t>({-127, -126, -125, -124, -123, -122}),
+ .data = TestBuffer::createFromVector<int8_t>({4, 8, 12, 16, 20, 24}),
.dimensions = {1, 2, 3},
.isIgnored = false,
.lifetime = TestOperandLifeTime::SUBGRAPH_INPUT,
.numberOfConsumers = 1,
- .scale = 1.0f,
+ .scale = 0.25f,
.type = TestOperandType::TENSOR_QUANT8_ASYMM_SIGNED,
- .zeroPoint = -128
+ .zeroPoint = 0
}, { // placeholder10
.channelQuant = {},
- .data = TestBuffer::createFromVector<int8_t>({-128}),
+ .data = TestBuffer::createFromVector<int8_t>({0}),
.dimensions = {1},
.isIgnored = false,
.lifetime = TestOperandLifeTime::CONSTANT_COPY,
.numberOfConsumers = 1,
- .scale = 1.0f,
+ .scale = 0.25f,
.type = TestOperandType::TENSOR_QUANT8_ASYMM_SIGNED,
- .zeroPoint = -128
+ .zeroPoint = 0
}, { // param10
.channelQuant = {},
.data = TestBuffer::createFromVector<int32_t>({0}),
@@ -1436,24 +1436,24 @@
.zeroPoint = 0
}, { // op21_new
.channelQuant = {},
- .data = TestBuffer::createFromVector<int8_t>({-121, -117, -113, -120, -116, -112, -119, -115, -111, -118, -114, -110}),
+ .data = TestBuffer::createFromVector<int8_t>({-50, -42, -34, -48, -40, -32, -46, -38, -30, -44, -36, -28}),
.dimensions = {1, 4, 3},
.isIgnored = false,
.lifetime = TestOperandLifeTime::SUBGRAPH_INPUT,
.numberOfConsumers = 1,
- .scale = 1.0f,
+ .scale = 0.5f,
.type = TestOperandType::TENSOR_QUANT8_ASYMM_SIGNED,
- .zeroPoint = -128
+ .zeroPoint = -64
}, { // placeholder11
.channelQuant = {},
- .data = TestBuffer::createFromVector<int8_t>({-128}),
+ .data = TestBuffer::createFromVector<int8_t>({-64}),
.dimensions = {1},
.isIgnored = false,
.lifetime = TestOperandLifeTime::CONSTANT_COPY,
.numberOfConsumers = 1,
- .scale = 1.0f,
+ .scale = 0.5f,
.type = TestOperandType::TENSOR_QUANT8_ASYMM_SIGNED,
- .zeroPoint = -128
+ .zeroPoint = -64
}, { // param11
.channelQuant = {},
.data = TestBuffer::createFromVector<int32_t>({0}),
@@ -2022,24 +2022,24 @@
.inputIndexes = {0, 1},
.operands = {{ // op12
.channelQuant = {},
- .data = TestBuffer::createFromVector<int8_t>({-127, -124, -126, -123, -125, -122}),
+ .data = TestBuffer::createFromVector<int8_t>({4, 16, 8, 20, 12, 24}),
.dimensions = {1, 3, 2},
.isIgnored = false,
.lifetime = TestOperandLifeTime::SUBGRAPH_INPUT,
.numberOfConsumers = 1,
- .scale = 1.0f,
+ .scale = 0.25f,
.type = TestOperandType::TENSOR_QUANT8_ASYMM_SIGNED,
- .zeroPoint = -128
+ .zeroPoint = 0
}, { // op22
.channelQuant = {},
- .data = TestBuffer::createFromVector<int8_t>({-121, -120, -119, -118, -117, -116, -115, -114, -113, -112, -111, -110}),
+ .data = TestBuffer::createFromVector<int8_t>({-50, -48, -46, -44, -42, -40, -38, -36, -34, -32, -30, -28}),
.dimensions = {1, 3, 4},
.isIgnored = false,
.lifetime = TestOperandLifeTime::SUBGRAPH_INPUT,
.numberOfConsumers = 1,
- .scale = 1.0f,
+ .scale = 0.5f,
.type = TestOperandType::TENSOR_QUANT8_ASYMM_SIGNED,
- .zeroPoint = -128
+ .zeroPoint = -64
}, { // adj02
.channelQuant = {},
.data = TestBuffer::createFromVector<bool8>({true}),
@@ -2104,9 +2104,9 @@
.isIgnored = false,
.lifetime = TestOperandLifeTime::TEMPORARY_VARIABLE,
.numberOfConsumers = 1,
- .scale = 1.0f,
+ .scale = 0.25f,
.type = TestOperandType::TENSOR_QUANT8_ASYMM_SIGNED,
- .zeroPoint = -128
+ .zeroPoint = 0
}, { // op22
.channelQuant = {},
.data = TestBuffer::createFromVector<int8_t>({}),
@@ -2114,9 +2114,9 @@
.isIgnored = false,
.lifetime = TestOperandLifeTime::TEMPORARY_VARIABLE,
.numberOfConsumers = 1,
- .scale = 1.0f,
+ .scale = 0.5f,
.type = TestOperandType::TENSOR_QUANT8_ASYMM_SIGNED,
- .zeroPoint = -128
+ .zeroPoint = -64
}, { // adj02
.channelQuant = {},
.data = TestBuffer::createFromVector<bool8>({true}),
@@ -2149,24 +2149,24 @@
.zeroPoint = -128
}, { // op12_new
.channelQuant = {},
- .data = TestBuffer::createFromVector<int8_t>({-127, -124, -126, -123, -125, -122}),
+ .data = TestBuffer::createFromVector<int8_t>({4, 16, 8, 20, 12, 24}),
.dimensions = {1, 3, 2},
.isIgnored = false,
.lifetime = TestOperandLifeTime::SUBGRAPH_INPUT,
.numberOfConsumers = 1,
- .scale = 1.0f,
+ .scale = 0.25f,
.type = TestOperandType::TENSOR_QUANT8_ASYMM_SIGNED,
- .zeroPoint = -128
+ .zeroPoint = 0
}, { // placeholder16
.channelQuant = {},
- .data = TestBuffer::createFromVector<int8_t>({-128}),
+ .data = TestBuffer::createFromVector<int8_t>({0}),
.dimensions = {1},
.isIgnored = false,
.lifetime = TestOperandLifeTime::CONSTANT_COPY,
.numberOfConsumers = 1,
- .scale = 1.0f,
+ .scale = 0.25f,
.type = TestOperandType::TENSOR_QUANT8_ASYMM_SIGNED,
- .zeroPoint = -128
+ .zeroPoint = 0
}, { // param16
.channelQuant = {},
.data = TestBuffer::createFromVector<int32_t>({0}),
@@ -2179,24 +2179,24 @@
.zeroPoint = 0
}, { // op22_new
.channelQuant = {},
- .data = TestBuffer::createFromVector<int8_t>({-121, -120, -119, -118, -117, -116, -115, -114, -113, -112, -111, -110}),
+ .data = TestBuffer::createFromVector<int8_t>({-50, -48, -46, -44, -42, -40, -38, -36, -34, -32, -30, -28}),
.dimensions = {1, 3, 4},
.isIgnored = false,
.lifetime = TestOperandLifeTime::SUBGRAPH_INPUT,
.numberOfConsumers = 1,
- .scale = 1.0f,
+ .scale = 0.5f,
.type = TestOperandType::TENSOR_QUANT8_ASYMM_SIGNED,
- .zeroPoint = -128
+ .zeroPoint = -64
}, { // placeholder17
.channelQuant = {},
- .data = TestBuffer::createFromVector<int8_t>({-128}),
+ .data = TestBuffer::createFromVector<int8_t>({-64}),
.dimensions = {1},
.isIgnored = false,
.lifetime = TestOperandLifeTime::CONSTANT_COPY,
.numberOfConsumers = 1,
- .scale = 1.0f,
+ .scale = 0.5f,
.type = TestOperandType::TENSOR_QUANT8_ASYMM_SIGNED,
- .zeroPoint = -128
+ .zeroPoint = -64
}, { // param17
.channelQuant = {},
.data = TestBuffer::createFromVector<int32_t>({0}),
@@ -2765,24 +2765,24 @@
.inputIndexes = {0, 1},
.operands = {{ // op13
.channelQuant = {},
- .data = TestBuffer::createFromVector<int8_t>({-127, -126, -125, -124, -123, -122, -127, -126, -125, -124, -123, -122}),
+ .data = TestBuffer::createFromVector<int8_t>({4, 8, 12, 16, 20, 24, 4, 8, 12, 16, 20, 24}),
.dimensions = {2, 2, 3},
.isIgnored = false,
.lifetime = TestOperandLifeTime::SUBGRAPH_INPUT,
.numberOfConsumers = 1,
- .scale = 1.0f,
+ .scale = 0.25f,
.type = TestOperandType::TENSOR_QUANT8_ASYMM_SIGNED,
- .zeroPoint = -128
+ .zeroPoint = 0
}, { // op23
.channelQuant = {},
- .data = TestBuffer::createFromVector<int8_t>({-121, -120, -119, -118, -117, -116, -115, -114, -113, -112, -111, -110, -121, -120, -119, -118, -117, -116, -115, -114, -113, -112, -111, -110}),
+ .data = TestBuffer::createFromVector<int8_t>({-50, -48, -46, -44, -42, -40, -38, -36, -34, -32, -30, -28, -50, -48, -46, -44, -42, -40, -38, -36, -34, -32, -30, -28}),
.dimensions = {2, 3, 4},
.isIgnored = false,
.lifetime = TestOperandLifeTime::SUBGRAPH_INPUT,
.numberOfConsumers = 1,
- .scale = 1.0f,
+ .scale = 0.5f,
.type = TestOperandType::TENSOR_QUANT8_ASYMM_SIGNED,
- .zeroPoint = -128
+ .zeroPoint = -64
}, { // adj03
.channelQuant = {},
.data = TestBuffer::createFromVector<bool8>({false}),
@@ -2847,9 +2847,9 @@
.isIgnored = false,
.lifetime = TestOperandLifeTime::TEMPORARY_VARIABLE,
.numberOfConsumers = 1,
- .scale = 1.0f,
+ .scale = 0.25f,
.type = TestOperandType::TENSOR_QUANT8_ASYMM_SIGNED,
- .zeroPoint = -128
+ .zeroPoint = 0
}, { // op23
.channelQuant = {},
.data = TestBuffer::createFromVector<int8_t>({}),
@@ -2857,9 +2857,9 @@
.isIgnored = false,
.lifetime = TestOperandLifeTime::TEMPORARY_VARIABLE,
.numberOfConsumers = 1,
- .scale = 1.0f,
+ .scale = 0.5f,
.type = TestOperandType::TENSOR_QUANT8_ASYMM_SIGNED,
- .zeroPoint = -128
+ .zeroPoint = -64
}, { // adj03
.channelQuant = {},
.data = TestBuffer::createFromVector<bool8>({false}),
@@ -2892,24 +2892,24 @@
.zeroPoint = -128
}, { // op13_new
.channelQuant = {},
- .data = TestBuffer::createFromVector<int8_t>({-127, -126, -125, -124, -123, -122, -127, -126, -125, -124, -123, -122}),
+ .data = TestBuffer::createFromVector<int8_t>({4, 8, 12, 16, 20, 24, 4, 8, 12, 16, 20, 24}),
.dimensions = {2, 2, 3},
.isIgnored = false,
.lifetime = TestOperandLifeTime::SUBGRAPH_INPUT,
.numberOfConsumers = 1,
- .scale = 1.0f,
+ .scale = 0.25f,
.type = TestOperandType::TENSOR_QUANT8_ASYMM_SIGNED,
- .zeroPoint = -128
+ .zeroPoint = 0
}, { // placeholder22
.channelQuant = {},
- .data = TestBuffer::createFromVector<int8_t>({-128}),
+ .data = TestBuffer::createFromVector<int8_t>({0}),
.dimensions = {1},
.isIgnored = false,
.lifetime = TestOperandLifeTime::CONSTANT_COPY,
.numberOfConsumers = 1,
- .scale = 1.0f,
+ .scale = 0.25f,
.type = TestOperandType::TENSOR_QUANT8_ASYMM_SIGNED,
- .zeroPoint = -128
+ .zeroPoint = 0
}, { // param22
.channelQuant = {},
.data = TestBuffer::createFromVector<int32_t>({0}),
@@ -2922,24 +2922,24 @@
.zeroPoint = 0
}, { // op23_new
.channelQuant = {},
- .data = TestBuffer::createFromVector<int8_t>({-121, -120, -119, -118, -117, -116, -115, -114, -113, -112, -111, -110, -121, -120, -119, -118, -117, -116, -115, -114, -113, -112, -111, -110}),
+ .data = TestBuffer::createFromVector<int8_t>({-50, -48, -46, -44, -42, -40, -38, -36, -34, -32, -30, -28, -50, -48, -46, -44, -42, -40, -38, -36, -34, -32, -30, -28}),
.dimensions = {2, 3, 4},
.isIgnored = false,
.lifetime = TestOperandLifeTime::SUBGRAPH_INPUT,
.numberOfConsumers = 1,
- .scale = 1.0f,
+ .scale = 0.5f,
.type = TestOperandType::TENSOR_QUANT8_ASYMM_SIGNED,
- .zeroPoint = -128
+ .zeroPoint = -64
}, { // placeholder23
.channelQuant = {},
- .data = TestBuffer::createFromVector<int8_t>({-128}),
+ .data = TestBuffer::createFromVector<int8_t>({-64}),
.dimensions = {1},
.isIgnored = false,
.lifetime = TestOperandLifeTime::CONSTANT_COPY,
.numberOfConsumers = 1,
- .scale = 1.0f,
+ .scale = 0.5f,
.type = TestOperandType::TENSOR_QUANT8_ASYMM_SIGNED,
- .zeroPoint = -128
+ .zeroPoint = -64
}, { // param23
.channelQuant = {},
.data = TestBuffer::createFromVector<int32_t>({0}),
diff --git a/runtime/test/specs/AIDL_V2/batch_matmul.mod.py b/runtime/test/specs/AIDL_V2/batch_matmul.mod.py
index 59a51db..2124f19 100644
--- a/runtime/test/specs/AIDL_V2/batch_matmul.mod.py
+++ b/runtime/test/specs/AIDL_V2/batch_matmul.mod.py
@@ -18,9 +18,9 @@
model = Model().Operation("BATCH_MATMUL", input0, input1, adj0, adj1).To(
output)
quant8_signed = DataTypeConverter().Identify({
- input0: ("TENSOR_QUANT8_ASYMM_SIGNED", 1, -128),
- input1: ("TENSOR_QUANT8_ASYMM_SIGNED", 1, -128),
- output: ("TENSOR_QUANT8_ASYMM_SIGNED", 1, -128),
+ input0: ("TENSOR_QUANT8_ASYMM_SIGNED", 0.25, 0),
+ input1: ("TENSOR_QUANT8_ASYMM_SIGNED", 0.50, -64),
+ output: ("TENSOR_QUANT8_ASYMM_SIGNED", 1.00, -128),
})
Example({
input0: input0_data,