Skip to content
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

add max_precision to onnx parser #1113

Merged
merged 1 commit into from
Nov 11, 2024
Merged

Conversation

jmitrevs
Copy link
Contributor

@jmitrevs jmitrevs commented Nov 6, 2024

Description

This is analogous to PR #1112 but for for ONNX. For ONNX, auto was the default, but max_precision was not set. This copies what we have for the Keras parser.

Type of change

  • New feature (non-breaking change which adds functionality)

Tests

We should make sure that this doesn't break anything, but truthfully, I am not sure if we have tests to test the max_precision behavior for any frontend, including Keras. Should we add such tests?

Checklist

  • I have read the guidelines for contributing.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation. (But some exists in PR Update README.md for v1.0.0 #1100)
  • My changes generate no new warnings.
  • I have installed and run pre-commit on the files I edited or added.
  • I have added tests that prove my fix is effective or that my feature works.

@@ -413,7 +413,7 @@ def make_layer_config(layer):


def config_from_onnx_model(
model, granularity='name', backend=None, default_precision='ap_fixed<16,6>', default_reuse_factor=1
model, granularity='name', backend=None, default_precision='fixed<16,6>', default_reuse_factor=1, max_precision=None
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out of curiosity, why this change of removing the ap_? Should I do the same in #1112?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This part is backend-agnostic, so there's no reason to put ap_ or ac_. (I think the ones without a prefix follow the ap_style, though, with regard to signedness, using uint/ufixed instead of false being passed as an argument.) The right type should be produced based on the backend, since it will internally go to the FixedPrecisionType. I think all thee styles are supported, those with either prefix, or without a prefix, regardless of the backend (i.e. there's no reason to change this when you switch backends).

@jmitrevs jmitrevs added this to the v1.0.0 milestone Nov 8, 2024
@JanFSchulte JanFSchulte merged commit e2fd8a5 into main Nov 11, 2024
7 of 8 checks passed
@JanFSchulte JanFSchulte deleted the onnx_parser_max_precision branch November 11, 2024 17:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants