GeezerVison is showing github.com — gh-90751: memoryview now supports half-float by corona10 · Pull Request #96738 · python/cpython
Conversation
corona10
commented
Sep 10, 2022
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
With patch
Python 3.12.0a0 (heads/gh-90751:ea5e2db2fa, Sep 10 2022, 15:41:30) [GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy as np
>>> a = np.array([0.0, -1.5], np.float16())
>>> list(memoryview(a))
[0.0, -1.5]
>>> memoryview(a.tobytes()).cast('e').tolist()
[0.0, -1.5]
>>>
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
(.oss) ➜ cpython git:(gh-90751) ✗ ./python.exe -m test test_memoryview -R 3:3
Raised RLIMIT_NOFILE: 256 -> 1024
0:00:00 load avg: 1.24 Run tests sequentially
0:00:00 load avg: 1.24 [1/1] test_memoryview
beginning 6 repetitions
123456
......
== Tests result: SUCCESS ==
1 test OK.
Total duration: 660 ms
Tests result: SUCCESS
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
corona10
changed the title
gh-90751: memoryview supports half-float
gh-90751: memoryview now supports half-float
Sep 10, 2022
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.
Thank you @corona10 .
Can you also add half-float to the generic tests in test_buffer.py?
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
|
When you're done making the requested changes, leave the comment: I have made the requested changes; please review again.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
@pitrou
Can you also add half-float to the generic tests in test_buffer.py?
Hmm, would you like to recommend the proper place?
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
corona10
commented
Sep 10, 2022
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
|
Thanks, I implemented unpack_cmp for half-float to pass your suggestion.
Now it passed all test suites :)
➜ cpython git:(gh-90751) ✗ ./python.exe -m test test_buffer -R 3:3
Raised RLIMIT_NOFILE: 256 -> 1024
0:00:00 load avg: 2.45 Run tests sequentially
0:00:00 load avg: 2.45 [1/1] test_buffer
beginning 6 repetitions
123456
......
test_buffer passed in 38.4 sec
== Tests result: SUCCESS ==
1 test OK.
Total duration: 38.4 sec
Tests result: SUCCESS
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
With Numpy installed I get errors, will push a fix.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
With Numpy installed I get errors, will push a fix.
Thanks
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
@pitrou
With numpy installation:
test_buffer leaked [1481, 1467, 1476] references, sum=4424
test_buffer failed (reference leak) in 53.9 sec
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
corona10
commented
Sep 10, 2022
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
|
Forget about #96738 (comment)
The leakage is not related to this PR, the main branch is leaked also.
(With NumPy only)
test_buffer leaked [1392, 1380, 1375] references, sum=4147
test_buffer failed (reference leak) in 50.1 sec
== Tests result: FAILURE ==
1 test failed:
test_buffer
Total duration: 50.1 sec
Tests result: FAILURE
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
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.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
The leakage is not related to this PR, the main branch is leaked also.
(With NumPy only)
Which Numpy version? I don't get this problem here.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Which Numpy version? I don't get this problem here.
@pitrou
Python 3.12.0a0 (heads/gh-90751:e8c1fed38f, Sep 10 2022, 17:46:55) [GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy as np
>>> np.__version__
'1.23.3'
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Reviewers
pitrou
pitrou approved these changes
gpshead
Awaiting requested review from gpshead
+1 more reviewer
Reviewers whose approvals may not affect merge requirements
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|