当前位置: 首页>>代码示例>>Python>>正文


Python numpy.ctypeslib方法代码示例

本文整理汇总了Python中numpy.ctypeslib方法的典型用法代码示例。如果您正苦于以下问题:Python numpy.ctypeslib方法的具体用法?Python numpy.ctypeslib怎么用?Python numpy.ctypeslib使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在numpy的用法示例。


在下文中一共展示了numpy.ctypeslib方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __new__

# 需要导入模块: import numpy [as 别名]
# 或者: from numpy import ctypeslib [as 别名]
def __new__(cls, ctypesArray, shape, dtype=float, strides=None, offset=0,
                order=None):
        # some magic (copied from numpy.ctypeslib) to make sure the ctypes
        # array has the array interface
        tp = type(ctypesArray)
        try:
            tp.__array_interface__
        except AttributeError:
            ctypeslib.prep_array(tp)

        obj = numpy.ndarray.__new__(
            cls, shape, dtype, ctypesArray, offset, strides, order)

        # keep track of the underlying storage
        # this may not be strictly necessary as the same info should be stored
        # in .base
        obj.ctypesArray = ctypesArray
        return obj 
开发者ID:friends-of-freeswitch,项目名称:switchio,代码行数:20,代码来源:shmarray.py

示例2: __new__

# 需要导入模块: import numpy [as 别名]
# 或者: from numpy import ctypeslib [as 别名]
def __new__(cls, ctypesArray, shape, dtype=float,
                strides=None, offset=0, order=None):

        # some magic (copied from numpy.ctypeslib) to make sure the ctypes array
        # has the array interface

        tp = type(ctypesArray)
        try:
            tp.__array_interface__
        except AttributeError:
            if hasattr(ctypeslib, 'prep_array'):
                ctypeslib.prep_array(tp)

        obj = numpy.ndarray.__new__(cls, shape, dtype, ctypesArray, offset, strides,
                                    order)

        # keep track of the underlying storage
        # this may not be strictly necessary as the same info should be stored in .base
        obj.ctypesArray = ctypesArray

        return obj 
开发者ID:vacancy,项目名称:Jacinle,代码行数:23,代码来源:shmarray.py


注:本文中的numpy.ctypeslib方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。