Skip to content

Conversation

@LeeKamentsky
Copy link
Contributor

This bug fixes some problems I'm seeing on our Linux build. I'm not sure if this is a change in behavior in Numpy 1.9 or is something caused by differences in the way the arrays are built. The basic problem is this construct:

> import numpy
> dtype = numpy.dtype([("A", "int32", "B", "int32")])
> a = numpy.array([[1, 2]], int).view(dtype)
> a.shape
(2, 1)

The problem is that "view" looks at the buffer, (0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,) and looks at the dtype which is two integers at four bytes apiece and carves the 16 bytes above into two 8 byte rows. The solution is to explicitly type arrays as numpy.int32 when this construct is used.

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.

1 participant