[Numpy-discussion] .max(0) on reshaped array returns inconsistent results.

Thouis (Ray) Jones thouis at gmail.com
Fri May 25 07:46:31 EDT 2012

I'm seeing some strange behavior from .max() on a reshaped array in
the current master, and wanted to raise it here to make sure it's not
something uniquely broken in my setup.

This code fails for me, though changing the context (adding a counter
to the loop, or running under "python -i") sometimes prevents it from
failing.  This code doesn't fail under 1.6.2.

import numpy as np

b = np.array([0, 1, 2, 3, 4, 5], np.int64)
a = b.reshape(3, 2)

while True:
    np.testing.assert_array_equal(np.atleast_1d(np.array(a.max(0), np.float)),
                                  np.atleast_1d(np.array(a.max(0), np.float)))

I spent several hours with valgrind trying to track down what was
causing this, but had no luck.  Perhaps someone with more knowledge of
the numpy ufunc internals can track it down faster than me.

I went ahead and filed a bug for it:

More information about the NumPy-Discussion mailing list