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 digression, nevermind.


On Thu, Apr 20, 2023 at 7:25 PM Stephan Hoyer <[email protected]> wrote:
>
>
> On Thu, Apr 20, 2023 at 9:12 AM Sebastian Berg <[email protected]> 
> 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 in favor, but
>> also many worried about the possible annoyance to users.
>> I decided to give the PR a shot, I may have misread the room on it
>> though:
>>
>>     https://github.com/numpy/numpy/pull/10615
>>
>> So if this turns out noisy (or you may simply disagree), I am happy to
>> revert!
>
>
> This looks like a great clean-up to me, thanks for giving this a try!
> _______________________________________________
> NumPy-Discussion mailing list -- [email protected]
> To unsubscribe send an email to [email protected]
> https://mail.python.org/mailman3/lists/numpy-discussion.python.org/
> Member address: [email protected]
_______________________________________________
NumPy-Discussion mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/numpy-discussion.python.org/
Member address: [email protected]

Reply via email to