Conversation
494d2f5 to
d49dc77
Compare
jreback
left a comment
There was a problem hiding this comment.
should test m8 as well (timedelta)
|
Added m8 tests. Thanks @jreback . Any other suggestions? |
| 'strides': x.strides, | ||
| 'shape': x.shape} | ||
|
|
||
| data = x.view('u1').data |
There was a problem hiding this comment.
I'm a little nervous about using view with a different dtype itemsize. See this warning from the docs:
For a.view(some_dtype), if some_dtype has a different number of bytes per entry than the previous dtype (for example, converting a regular array to a structured array), then the behavior of the view cannot be predicted just from the superficial appearance of a (shown by print(a)). It also depends on exactly how a is stored in memory. Therefore if a is C-ordered versus fortran-ordered, versus defined as a slice or transpose, etc., the view may give different results.
It might be just fine for merely getting access to the data buffer, though.
There was a problem hiding this comment.
Yeah, I think that these would all be tricky situations if the itemsizes were relatively prime or if you actually cared about indexing afterwards. I think we're safe turning it into a view of singleton bytes though.
|
numpy scalars e.g. np.array(5) |
|
maybe big/little endian e.g. >i8 and <i8 |
Fixes #635
cc @shoyer