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
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
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
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
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
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