diff options
author | Sergei Lebedev <slebedev@google.com> | 2019-04-24 14:04:18 +0100 |
---|---|---|
committer | Sergei Lebedev <slebedev@google.com> | 2019-05-19 20:05:55 +0100 |
commit | 71fc59d587016d6f36007ba06e074d4d4a6b483d (patch) | |
tree | 17c6e5435c3a28ed6eaae928d1ee7da5223de8a9 /numpy/core/fromnumeric.py | |
parent | f91b033aa35b929610c0db12f16b1b0c1ddc08e6 (diff) | |
download | numpy-71fc59d587016d6f36007ba06e074d4d4a6b483d.tar.gz |
ENH: Improved performance of PyArray_FromAny for sequences of array-like
Prior to this commit
np.array([array_like])
would recursively copy each element of array_like. This is due to the
fact that setArrayFromSequence only special-cased lists of NumPy arrays,
any other object was treated as a sequence even if it supported buffer
or __array*__ interfaces. See tensorflow/tensorflow#27692 for details.
The commit generalizes the special-case in setArrayFromSequence to any
array-like, i.e. a buffer or an object with __array__, __array_interface__
__array_struct__.
Diffstat (limited to 'numpy/core/fromnumeric.py')
0 files changed, 0 insertions, 0 deletions