【问题标题】:How to get the size of typed memoryviews in cython如何在 cython 中获取类型化内存视图的大小
【发布时间】:2013-12-05 14:37:17
【问题描述】:

是否可以在 cython 中获取 MemoryView 的大小?理想情况下,我在 numpy 中寻找类似 @​​987654321@ 的东西。

【问题讨论】:

    标签: python python-3.x cython memoryview


    【解决方案1】:

    来自http://docs.python.org/3.3/library/stdtypes.html#memoryview

    len(view) 等于 tolist 的长度。如果 view.ndim = 0,则 length 为 1。如果 view.ndim = 1,则长度等于 视图中的元素。对于更高的维度,长度等于 视图的嵌套列表表示的长度。项目大小 属性将为您提供单个元素中的字节数。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-11-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-05-25
      • 1970-01-01
      相关资源
      最近更新 更多