forked from numpy/numpy
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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__.
- Loading branch information
1 parent
f91b033
commit 71fc59d
Showing
3 changed files
with
140 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters