[Numpy-discussion] Re: Giving deprecation of e.g. `float(np.array([1]))` a shot (not 0-d)

2023-04-20 Thread Sebastian Berg
On Thu, 2023-04-20 at 13:59 -0400, Warren Weckesser wrote: > On 4/20/23, Sebastian Berg wrote: > > Hi all, > > > > > > In [64]: np.float64(np.array([0.0])) > :1: DeprecationWarning: Conversion of > an array with ndim > 0 to a scalar is deprecated, and will error in > future. Ensure you extra

[Numpy-discussion] Re: Giving deprecation of e.g. `float(np.array([1]))` a shot (not 0-d)

2023-04-20 Thread Warren Weckesser
On 4/20/23, Sebastian Berg wrote: > Hi all, > > Unlike conversions of 0-d arrays via: > > float(np.array([1])) > > conversions of 1-D or higher dimensional arrays with a single element > are a bit strange: > > float(np.array([1])) > > And deprecating it has come up often enough with many i

[Numpy-discussion] Re: Giving deprecation of e.g. `float(np.array([1]))` a shot (not 0-d)

2023-04-20 Thread Robert Kern
On Thu, Apr 20, 2023 at 12:39 PM Evgeni Burovski wrote: > If symmetry w.r.t. pytorch is any guide, it was nice to have it: > > In [38]: float(torch.as_tensor([2])) > Out[38]: 2.0 > > In [39]: float(np.asarray([2])) > Out[39]: 2.0 > My question would be: Did they have a positive use case for this

[Numpy-discussion] Re: Giving deprecation of e.g. `float(np.array([1]))` a shot (not 0-d)

2023-04-20 Thread Evgeni Burovski
If symmetry w.r.t. pytorch is any guide, it was nice to have it: In [38]: float(torch.as_tensor([2])) Out[38]: 2.0 In [39]: float(np.asarray([2])) Out[39]: 2.0 I guess this boils down to what is a scalar really: is it `scalar.size == 1` or `scalar.ndim == 0` or something else. But that's just a

[Numpy-discussion] Re: Giving deprecation of e.g. `float(np.array([1]))` a shot (not 0-d)

2023-04-20 Thread Stephan Hoyer
On Thu, Apr 20, 2023 at 9:12 AM Sebastian Berg wrote: > Hi all, > > Unlike conversions of 0-d arrays via: > > float(np.array([1])) > > conversions of 1-D or higher dimensional arrays with a single element > are a bit strange: > > float(np.array([1])) > > And deprecating it has come up oft

[Numpy-discussion] Giving deprecation of e.g. `float(np.array([1]))` a shot (not 0-d)

2023-04-20 Thread Sebastian Berg
Hi all, Unlike conversions of 0-d arrays via:     float(np.array([1])) conversions of 1-D or higher dimensional arrays with a single element are a bit strange:     float(np.array([1])) And deprecating it has come up often enough with many in favor, but also many worried about the possible ann