__init__.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:srep 作者: Answeror 项目源码 文件源码
def windowed_view(arr, window, overlap):
    from numpy.lib.stride_tricks import as_strided
    arr = np.asarray(arr)
    window_step = window - overlap
    new_shape = arr.shape[:-1] + ((arr.shape[-1] - overlap) // window_step,
                                  window)
    new_strides = (arr.strides[:-1] + (window_step * arr.strides[-1],) +
                   arr.strides[-1:])
    return as_strided(arr, shape=new_shape, strides=new_strides)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号