-
Notifications
You must be signed in to change notification settings - Fork 81
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
Convert floats representing integers to int in sample set serialization #1354
Convert floats representing integers to int in sample set serialization #1354
Conversation
55fd909
to
ea17840
Compare
ea17840
to
7b75d7f
Compare
Codecov Report
@@ Coverage Diff @@
## main #1354 +/- ##
==========================================
- Coverage 95.08% 95.07% -0.01%
==========================================
Files 95 95
Lines 9902 9914 +12
==========================================
+ Hits 9415 9426 +11
- Misses 487 488 +1
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
dimod/serialization/utils.py
Outdated
``int``. | ||
|
||
This function assumes some uniformity of the list structure. For instance giving it | ||
a list like ``[0.0, 0]`` or ``[0.0, [0.0]`` will cause it to fail. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo: missing ]
dimod/serialization/utils.py
Outdated
|
||
else: | ||
raise ValueError("expected a (possibly nested) list of floats, " | ||
f"recieved a (possible nested) list of {type(arr[0])}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typos: received, possibly
This does come with a performance hit. However it is relatively minor. Testing two edge cases on my system
takes
~5.5
seconds on this branch and~1
second on dimod 0.12.10.takes
~3.5
seconds on this branch and~1
second on dimod 0.12.10.For context, actually Json-serializing the resulting object at this scale takes
~27.8
seconds to dump to a file and~6.7
seconds to dump to a string.