Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork11.9k
ENH: Have dtype transfer for equivalent user dtypes prefer user-definedcopyswapn#10898
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
eric-wieser commentedApr 12, 2018
Is there a reason that enabling Perhaps renaming |
EricCousineau-TRI commentedApr 13, 2018 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Hmm... My understanding, from having looked at some of the NumPy v1.11.0 source (what I'm using on Ubuntu), is that Looking at Will still try it out on my test case to see if it works out, and post the results here. Thanks! EDIT: Checked against v1.11.0 (unpatched) from system, and it works for EDIT 2: Confirmed that If these inconsistencies were fixed, then That also being said, if there is a hook to cause EDIT 3: I may risk the segfaults with |
eric-wieser commentedApr 13, 2018
Looking again - seems you're right, Unfortunately, the So maybe this is the best call. I worry that there will be a lot of places that just assume they can memcpy a user dtype though, so this will be the first of many changes you need to make. Why is it that a memcpy doesn't work for you? |
EricCousineau-TRI commentedApr 13, 2018 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Ah, gotcha. For the most part, though, it seems that the main algorithms do well in using the correct dispatches to copy arrays. Though I'm sure I'll run into that issue at some point. It'll be an interesting adventure, then :P
In this case, EDIT: This may be jumping the design gun, but in the future, could |
EricCousineau-TRI commentedApr 19, 2018
Just checking back in on this PR - may I ask if there's anything I may do to increase confidence in its change to see if it can be merged into Perhaps instrument some user-defined dtype test to check which user-defined methods have been called? |
eric-wieser commentedApr 20, 2018
I think this is probably fine as it. The change is pretty straightforward, and I assume your code works with it. There's a slight performance penalty here for custom dtypes, but I imagine it's pretty minor - those users can presumably just call If no one else has any opinions on this, I'll merge it in a few days. Tagging with 1.15 so I don't forget. |
EricCousineau-TRI commentedApr 20, 2018 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Awesome, thanks!
One concern is it looks like EDIT: Er, just to clarify, I don't think this PR should be blocked on account of a convenience method being user-accessible; for the time being, it seems like it's more-or-less trivial to write a non-swap version of |
EricCousineau-TRI commentedApr 26, 2018 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
@eric-wieser Just a small ping, if you're able to merge it - thanks! (Would love to employ this on |
7d247f4 to8507eb3Compareeric-wieser commentedMay 18, 2018 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
My point is that Can you perhaps add something to the release notes about this change? |
EricCousineau-TRI commentedMay 18, 2018 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Yup, can do! Should I file an issue to consider exposing |
8507eb3 to682403eCompareEricCousineau-TRI commentedMay 18, 2018
Done. Added an initial pass at release notes; please let me know what you'd like me to change. |
| !PyDataType_REFCHK(src_dtype)&& !PyDataType_REFCHK(dst_dtype)&& | ||
| ( !PyDataType_HASFIELDS(dst_dtype)|| | ||
| is_dtype_struct_simple_unaligned_layout(dst_dtype)) ) { | ||
| is_dtype_struct_simple_unaligned_layout(dst_dtype))&& |
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.
Indentation needs fix.
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.
I had meant to have this align with col 13 since it's part of the conjunction&& operands, so that it should align with the beginning of the parentheses (and!PyDataType_REFCHK(...l).
If you want, I can move this line up to make the continuation more evident?
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.
NVM, I misread the code.
charris commentedMay 25, 2018
@eric-wieser Ping. |
charris commentedMay 27, 2018
LGTM.@eric-wieser I'll leave this to you. |
eric-wieser commentedMay 28, 2018
Thanks@EricCousineau-TRI |
Uh oh!
There was an error while loading.Please reload this page.
Resolves#10897
This is a simple way that initially enables things like exposing autodiff scalars with heap-allocated derivatives. See the original issue for more info.
This Travis build job shows the code working with this patch (well, an older version of it):
https://travis-ci.org/RobotLocomotion/pybind11/jobs/364928883#L1630-L1635
\cc@njsmith - Since this is a relatively small change, figured I'd see if this appropriate to upstream at this point.