Comments (3)
I noticed some issues with the latest version only (0.7.0) but not the one before (0.6.2).
Grouped convolutions (FP or binary) are converted as custom ops in the latest version.
Example:
Grouped (g=2) convs converter output:
2022-07-26 13:06:17.469686: W external/org_tensorflow/tensorflow/compiler/mlir/lite/flatbuffer_export.cc:1903] The following operation(s) need TFLite custom op implementation(s):
Custom ops: Conv2D
Details:
tf.Conv2D(tensor<1x32x32x64xf32>, tensor<5x5x32x32xf32>) -> (tensor<1x11x11x32xf32>) : {data_format = "NHWC", dilations = [1, 1, 1, 1], explicit_paddings = [], padding = "SAME", strides = [1, 3, 3, 1], use_cudnn_on_gpu = true}
See instructions: https://www.tensorflow.org/lite/guide/ops_custom
2022-07-26 13:06:17.469772: I external/org_tensorflow/tensorflow/compiler/mlir/lite/flatbuffer_export.cc:1963] Estimated count of arithmetic ops: 5792 ops, equivalently 2896 MACsEstimated count of arithmetic ops: 5792 ops, equivalently 2896 MACs
Quantizer small example (2 qconv layers):
Example with ste_sign mode="weights":
2022-07-26 13:14:57.680246: I external/org_tensorflow/tensorflow/compiler/mlir/lite/flatbuffer_export.cc:1963] Estimated count of arithmetic ops: 1.164 M ops, equivalently 0.582 M MACs
Estimated count of arithmetic ops: 1.164 M ops, equivalently 0.582 M MACs
Changing to DoReFa mode="weights":
2022-07-26 13:16:05.771057: I external/org_tensorflow/tensorflow/compiler/mlir/lite/flatbuffer_export.cc:1963] Estimated count of arithmetic ops: 1.663 M ops, equivalently 0.831 M MACs
Estimated count of arithmetic ops: 1.663 M ops, equivalently 0.831 M MACs
I was able to successfully benchmark my model with DoReFa and grouped convolutions converted on version 0.6.2 with a better-than-expected efficiency but not the one converted with version 0.7.0
I am using Tensorflow 2.8.0 and larq 0.12.2
from compute-engine.
Sorry for the late reply.
I noticed some issues with the latest version only (0.7.0) but not the one before (0.6.2).
Grouped convolutions (FP or binary) are converted as custom ops in the latest version.
Unfortunately this was an issue with TensorFlow 2.8 which LCE 0.7.0 uses under the hood. This has been fixed on master since we upgraded to 2.9, but we haven't published a new release with it yet. Sorry about that. For now, I'd recommend sticking with 0.6.2 if grouped convolution support is required.
Is the "ste_sign" quantizer the only viable option for efficient inference?
For binarised convolutions this is recommended for the activation. You can also use custom activation quantisers as well, but to make sure they convert correctly they should be implemented with larq.math.sign
which unfortunately is not the case for DoReFa. Regarding weight quantization other quantisers should work fine as long as they binarise to {-1, 1}
or {-alpha, alpha}
.
I recommend looking at the converted model in Netron to make sure the conversion worked as intended.
from compute-engine.
I noticed some issues with the latest version only (0.7.0) but not the one before (0.6.2).
Grouped convolutions (FP or binary) are converted as custom ops in the latest version.
@lluevano sorry for the delay. We just release v0.8.0 including a fix for this. Let me know if that works for you.
from compute-engine.
Related Issues (20)
- Automatic release builds for benchmarking binaries are broken HOT 2
- Deployment on Cortex-M HOT 2
- Tensor transform triggers dequantization HOT 6
- Error on import HOT 2
- Select indirect BGEMM kernels - Benchmarking grouped binary convolutions HOT 3
- LCEInterpreter and converter design HOT 1
- core dumped when number of threads is larger than 2 HOT 3
- Benchmarking custom model HOT 3
- Int8 quantization for microcontroller HOT 13
- Failed import 'org.tensorflow.lite.DataType' on Android project HOT 8
- `convert_keras_model()` does not work as expected for BinaryDenseNet37 Dilated and XNORNet HOT 1
- Get Operator-wise Profiling Results HOT 1
- Error while performing benchmarking HOT 44
- Bool input tensor HOT 7
- extra model size induced by non-parameter layer HOT 1
- Fix Android benchmarker build
- Larq Compute Engine seems incompatible with tensorflow-lite-task-vision on Android (using the latest tensorflow lite demo code) HOT 2
- Dorefa model size and behavior with full precision model and ste_sign model HOT 13
- Cannot save compressed binary or ternary weights, saved as float32 parameters HOT 12
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 compute-engine.