-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
QKeras to QONNX converter #7
Conversation
Hi @vloncar,
I also have yet to run some actual execution tests to compare the QKeras and onnx execution, but with these changes that should become easier to implement in the next few days. As an aside: Do you know if the tf2onnx API has some auto-generated documentation somewhere? I noticed that there are comments in the code for such a process, but on their project page I could only find their general documentation for the tool, not the API. |
This is a great start, thanks @vloncar ! Couple of comments & questions from a joint discussion with @HenniOVP , @volcacius and myself that came up while reviewing:
|
A brief summary of discussion on @maltanar's questions:
|
Just checking in on this PR, and doing some housekeeping. I also checked which tests fail:
Only the Error message:
|
Hi @jmduarte , |
To add some info on the other failing tests, they mostly use have the pattern of an activation layer like |
I think it comes from the fact that the shapes are not correct for the quantized relu. I added some debug statements in print("debug")
print("node inputs", node.input)
print("node input 0", node.input[0])
print("shape", ctx.get_shape(node.input[0])) output for
output for
|
…on against so far unsupported features. More tests.
To do:
|
discussion can continue in #28 |
Long-overdue, incomplete, horribly-coded first stab at the QKeras to QONNX converter.
It relies on tf2onnx to perform the actual conversion. The conversion is done in several steps:
The 3rd step can in theory be replaced with the
ModelWrapper
-based approach after the initial conversion, however for thatModelWrapper
needs to be extended with graph manipulation routines (like, insert before/after a specific node, remove node etc). Also, the name mangling that occurs after the model comes out of tf2onnx makes it more difficult to map the layer names in ONNX to the saved quantizer map. This was the original idea, however I couldn't figure out a perfect way to deduce the final layer names. It makes sense to revisit this once I get a bit more knowledge on the insides of tf2onnx.Some known caveats:
pre-commit
doesn't like the code.