[Numpy-discussion] nasty bug in 1.8.0??

Sebastian Berg sebastian at sipsolutions.net
Mon Dec 2 16:48:21 EST 2013


On Mon, 2013-12-02 at 14:51 -0500, Neal Becker wrote:
> The software I'm using, which is 
> 
> https://github.com/ndarray/ndarray
> 
> does depend on this.  Am I the only one who thinks that this
> behavior is not desirable?
> 

Well, this is not meant to be the way for a release version of numpy.
The rational was that since arbitrary strides *are* possible for such
arrays, creating them with arbitrary strides when you use
NPY_RELAXED_STRIDES_CHECKING=1 helps finding bugs.
Of course you are right to suppose that a *new* array should generally
have nice and clean strides, but if your code does work with arrays you
did not yourself create, it cannot make these assumptions. And I think
most code does this. And there are some advantages to ignoring such
strides for the contiguous flags.

If your arrays are contiguous, you don't really need the strides (use
the itemsize instead). How is ndarray broken by this?

- Sebastian


> Frédéric Bastien wrote:
> 
> > Just don't compile with NPY_RELAXED_STRIDES_CHECKING to have the old
> > behavior I think (which is an not always the same strides depending of
> > how it was created, I don't know if they changed that or not).
> > 
> > Do someone else recall the detail of this?
> > 
> > Fred
> > 
> > p.s. I didn't do this or asked for it. But this help test your
> > software to don't depend of the strides when shapes is 1.
> > 
> > On Mon, Dec 2, 2013 at 2:35 PM, Neal Becker <ndbecker2 at gmail.com> wrote:
> >> I don't think that behavior is acceptable.
> >>
> >> Frédéric Bastien wrote:
> >>
> >>> It is the NPY_RELAXED_STRIDES_CHECKING=1 flag that caused this.
> >>>
> >>> Fred
> >>>
> >>> On Mon, Dec 2, 2013 at 2:18 PM, Neal Becker <ndbecker2 at gmail.com> wrote:
> >>>> I built using:
> >>>>
> >>>> CFLAGS='-march=native -O3' NPY_RELAXED_STRIDES_CHECKING=1 python3 setup.py
> >>>> install --user
> >>>>
> >>>>
> >>>> aπid wrote:
> >>>>
> >>>>> I get:
> >>>>>
> >>>>> In [4]: x.strides
> >>>>> Out[4]: (8,)
> >>>>>
> >>>>> Same architecture and OS, Numpy installed via Pip on Python 2.7.5.
> >>>>>
> >>>>>
> >>>>> On 2 December 2013 20:08, Neal Becker <ndbecker2 at gmail.com> wrote:
> >>>>>
> >>>>>> This is np 1.8.0 on fedora x86_64:
> >>>>>>
> >>>>>> In [5]: x =np.array ((1,))
> >>>>>>
> >>>>>> In [6]: x.shape
> >>>>>> Out[6]: (1,)
> >>>>>>
> >>>>>> In [7]: x.strides
> >>>>>> Out[7]: (9223372036854775807,)
> >>>>>>
> >>>>>> _______________________________________________
> >>>>>> NumPy-Discussion mailing list
> >>>>>> NumPy-Discussion at scipy.org
> >>>>>> http://mail.scipy.org/mailman/listinfo/numpy-discussion
> >>>>>>
> >>>>
> >>>>
> >>>> _______________________________________________
> >>>> NumPy-Discussion mailing list
> >>>> NumPy-Discussion at scipy.org
> >>>> http://mail.scipy.org/mailman/listinfo/numpy-discussion
> >>> _______________________________________________
> >>> NumPy-Discussion mailing list
> >>> NumPy-Discussion at scipy.org
> >>> http://mail.scipy.org/mailman/listinfo/numpy-discussion
> >>
> >>
> >> _______________________________________________
> >> NumPy-Discussion mailing list
> >> NumPy-Discussion at scipy.org
> >> http://mail.scipy.org/mailman/listinfo/numpy-discussion
> > _______________________________________________
> > NumPy-Discussion mailing list
> > NumPy-Discussion at scipy.org
> > http://mail.scipy.org/mailman/listinfo/numpy-discussion
> 
> 
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion





More information about the NumPy-Discussion mailing list