How to use numpy as_strided (from np.stride_tricks) correctly?

后端 未结 3 1813
青春惊慌失措
青春惊慌失措 2021-01-20 10:32

I\'m trying to reshape a numpy array using numpy.strided_tricks. This is the guide I\'m following: https://stackoverflow.com/a/2487551/4909087

My use c

3条回答
  •  悲哀的现实
    2021-01-20 11:17

    I have no idea why you think you need strides of 3. You need strides the distance in bytes between one element of a and the next, which you can get using a.strides:

    as_strided(a, (len(a) - 2, 3), a.strides*2)
    

提交回复
热议问题