![](https://secure.gravatar.com/avatar/08bcb178fb791b7c8a5e9ad8d7121bed.jpg?s=120&d=mm&r=g)
I see now the original motivation as the unfortunate situation that mxnet authors did not understand that np.ascontiguousarray returned an array of at least one dimension and perhaps used that one API to assume that NumPy did not support 0-d arrays --- which NumPy does indeed support. Certainly that situation would motivate a documentation change to help steer other future users from making the same incorrect assumption, but deprecation is a separate question entirely. I do not agree at all with the trend to remove functions from NumPy API prior to a dedicated NumPy 2.0 effort. This breaks the idea of semantic versioning for NumPy. These functions do, in fact, have a use and were very much intended to produce one-dimensional arrays --- in order to be used prior to calling C or Fortran code that expected at least a 1-d array. A lot of the SciPy wrapping code needed this behavior. It is a misinterpretation to assume this is buggy or unintended. Improving the documentation to warn about the behavior for 0-d arrays could indeed be useful. -Travis On Fri, Oct 26, 2018 at 6:27 PM Stephan Hoyer <shoyer@gmail.com> wrote:
On Fri, Oct 26, 2018 at 3:48 PM Sebastian Berg <sebastian@sipsolutions.net> wrote:
On Fri, 2018-10-26 at 13:25 -0700, Stephan Hoyer wrote:
On Fri, Oct 26, 2018 at 12:55 PM Alex Rogozhnikov < alex.rogozhnikov@yandex.ru> wrote:
The conservative way to handle this would be to do a deprecation cycle, specifically by issuing FutureWarning when scalars or 0d arrays are encountered as inputs. Sounds good to me. Behavior should be scheduled for numpy 1.18?
Yes, that sounds about right to me.
Is there a way to avoid the future warning? An unavoidable warning in a widely used function seems really annoying to me. Unless, the 0d thing happens rarely, but then it might be the downstream users that get the warning for no reason.
- Sebastian
My suspicion is that 0d arrays are rarely used as arguments to ascontiguousarray / asfortranarray. But it's hard to say for sure... _______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@python.org https://mail.python.org/mailman/listinfo/numpy-discussion