Join GitHub today
[MRG+1] Use astype(.., copy=False) when possible #11973
I have manually reviewed all cases of
To support the copy argument for both sparse and dense arrays, a new
X = X.astype('float32', **_astype_copy_false(X))
This is somewhat awkward, however it makes it explicit that this is a temporary fix that can be dropped once we only support scipy > 1.1 and IMO is better in this sense than,
if X.dtype != np.float32: X = X.astype('float32', copy=False)
as the latter essentially permanently re-implements some checks from numpy/scipy.
LGTM. if you could have a pass on the following occurences. I am not 100% sure that they should change.