Comments (3)
Looked into the tflite/gemmlowp stack. So, for quantized conv
https://github.com/tensorflow/tensorflow/blob/c865ec5621c013a7f8a4a26d380782e63117224f/tensorflow/lite/kernels/internal/optimized/optimized_ops.h#L2082-L2085 , which loads lhs (filter, value range int8*int8 + int8*int8
value size can hold in int16.
However, I am not sure how the input uint8 data
gemmlowp/internal/kernel_neon.h
Lines 942 to 945 in 58825b1
gemmlowp/internal/kernel_neon.h
Line 958 in 58825b1
gemmlowp/internal/kernel_neon.h
Lines 988 to 989 in 58825b1
Would you please give a hint?
from gemmlowp.
You are right that the comment at kernel_neon.h:708 is incorrect. It fails to mention that in order to avoid overflow in int16 := int8*int8 + int8*int8
, it is necessary to require the int8 values to avoid the value -128.
As you found, this has been amended in the paper and in the way that TFLite uses this. As you found, there is a signedness discrepancy between on the one hand, the 8bit buffers in TFlite and at the API surface of gemmlowp, where everything is unsigned uint8, and in the kernels internally in gemmlowp, where everything is signed int8. The switch from unsigned to signed is implemented in the 'packing' phase of gemmlowp.
For the pack/compute/unpack phases of gemmlowp, refer to this doc:
https://github.com/google/gemmlowp/blob/master/doc/design.md
The portable (not NEON) implementation of the packing phase is this file:
https://github.com/google/gemmlowp/blob/master/internal/pack.h
Inside it, here is where the unsigned->signed conversion occurs:
Lines 272 to 273 in 58825b1
from gemmlowp.
Thank you @bjacob for the detailed knowledge sharing! That's really helpful! I didn't notice that there is a packing process in gemmlowp, should have read the docs carefully.
from gemmlowp.
Related Issues (20)
- eight_bit_int_gemm get all zero output and segment fault HOT 4
- A problem with the design of kernel in Arm64 HOT 1
- error result when W and X don't range from -1 to 1 HOT 2
- Add two feature maps HOT 1
- run dotprod instruction failed on apple A12 and qualcomm 845 HOT 1
- Error compilation for Windows x64 using MingGW 64 HOT 1
- Python 3 support HOT 2
- How can I use a new gemm-kernel in tensorflow or other machine learning framework? HOT 1
- How to quantize accumulator from int32 to uint8 HOT 4
- Quantize matmul in CPU avx2 have effect?
- no such package '@remotejdk_linux//':
- what is "ab_x2_high32" in <func::SaturatingRoundingDoublingHighMul> stand for?
- How to calculate non-linear function after 8bit quantization ? HOT 1
- SIMD back-end for IBM Power and Z HOT 3
- Issues compiling for bare metal application HOT 2
- How to use gemmlowp in C project?
- int8*int8 -> float? HOT 3
- is D in your fomation (2) calculated by this?
- Suggestions for resources to understand gemmlowp HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gemmlowp.