Sebastian Berg sipsolutions.net> writes:
>
> Hello,
>
> looking at the code, when only adding/removing dimensions with size 1,
> numpy takes a small shortcut, however it uses 0 stride lengths as value
> for the new one element dimensions temporarily, then replacing it again
> to ensure the new
Hello,
looking at the code, when only adding/removing dimensions with size 1,
numpy takes a small shortcut, however it uses 0 stride lengths as value
for the new one element dimensions temporarily, then replacing it again
to ensure the new array is contiguous.
This replacing does not check if the
Dave Hirschfeld gmail.com> writes:
>
> It seems that reshape doesn't work correctly on an array which has been
> resized using the 0-stride trick e.g.
>
> In [73]: x = array([5])
>
> In [74]: y = as_strided(x, shape=(10,), strides=(0,))
>
> In [75]: y
> Out[75]: array([5, 5, 5, 5, 5, 5, 5, 5,
It seems that reshape doesn't work correctly on an array which has been
resized using the 0-stride trick e.g.
In [73]: x = array([5])
In [74]: y = as_strided(x, shape=(10,), strides=(0,))
In [75]: y
Out[75]: array([5, 5, 5, 5, 5, 5, 5, 5, 5, 5])
In [76]: y.reshape([10,1])
Out[76]:
array([[