ComputeLibrary icon indicating copy to clipboard operation
ComputeLibrary copied to clipboard

Wrong result of NEGEMMLowpMatrixMultiplyCore with two QASYMM8_SIGNED input

Open zjersey opened this issue 3 years ago • 0 comments

My need is to multiply two int8 tensors ([-127, 127]) to get the result S32 tensor (signed int32).

I run the codes below:

q_src1.allocator()->init(TensorInfo(TensorShape(2, 2), 1, DataType::QASYMM8_SIGNED, src1_qinfo));  
q_src2.allocator()->init(TensorInfo(TensorShape(2, 2), 1, DataType::QASYMM8_SIGNED, src2_qinfo)); 
q_res.allocator()->init(TensorInfo(TensorShape(2, 2), 1, DataType::S32));
NEGEMMLowpMatrixMultiplyCore qgemm;
qgemm.configure(&q_src1, &q_src2, nullptr, &q_res);
// I manually set the values of q_src1 and q_src2, and allocate the three tensors.

qgemm.run();

printf("q_src1.print(): \n");
q_src1.print(std::cout);
printf("q_src2.print(): \n");
q_src2.print(std::cout);
printf("q_res.print(): \n");
q_res.print(std::cout);

The result is:

q_src1.print(): 
 -2  -3 
124  97 

q_src2.print(): 
 4 -110 
64  -87 

q_res.print(): 
 75033  22979 
117419  35901

How can I get the correct signed int32 results?

zjersey avatar Aug 02 '22 07:08 zjersey