[Numpy-discussion] Regression in mpl: AttributeError: incompatible shape for a non-contiguous array
Mon Oct 29 10:18:36 CDT 2012
On Mon, Oct 29, 2012 at 11:04 AM, Patrick Marsh <firstname.lastname@example.org>wrote:
> Turns out it isn't the commit I thought it was. I'm currently going
> through a git bisect to track down the actual commit that introduced this
> bug. I'll post back when I've found it.
> Patrick Marsh
> Ph.D. Candidate / Liaison to the HWT
> School of Meteorology / University of Oklahoma
> Cooperative Institute for Mesoscale Meteorological Studies
> National Severe Storms Laboratory
> On Mon, Oct 29, 2012 at 9:43 AM, Benjamin Root <email@example.com> wrote:
>> On Mon, Oct 29, 2012 at 10:33 AM, Sebastian Berg <
>> firstname.lastname@example.org> wrote:
>>> On Mon, 2012-10-29 at 09:54 -0400, Benjamin Root wrote:
>>> > This error started showing up in the test suite for mpl when using
>>> > numpy master.
>>> > AttributeError: incompatible shape for a non-contiguous array
>>> > The tracebacks all point back to various code points where we are
>>> > trying to set the shape of an array, e.g.,
>>> > offsets.shape = (-1, 2)
>>> Could you give a hint what these arrays history (how it was created) and
>>> maybe .shape/.strides is? Sounds like the array is not contiguous when
>>> it is expected to be, or the attribute setting itself fails in some
>>> corner cases on master?
>> The original reporter of the bug dug into the commit list and suspects it
>> was this one:
>> However, it might be earlier than that (he is currently doing a clean
>> rebuild to make sure).
>> As for the history:
>> offsets = np.asanyarray(offsets)
>> offsets.shape = (-1, 2) # Make it Nx2
>> Where "offsets" comes in from (possibly) user-supplied data. Nothing
>> really all that special. I will see if I can get stride information.
>> Ben Root
Further digging reveals that the code fails when the array is originally
1-D. I had an array with shape (2,) and stride (8,). The reshaping should
result in a shape of (1, 2).
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the NumPy-Discussion