shared.py 文件源码

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

项目:denet 作者: lachlants 项目源码 文件源码
def __init__(self, shape, dtype = numpy.float32):
        num_elems = numpy.prod(shape)

        if dtype == numpy.int32:
            c_type = ctypes.c_int
        elif dtype == numpy.float32:
            c_type = ctypes.c_float
        elif dtype == numpy.float64:
            c_type = ctypes.c_double
        else:
            assert(0)

        #shared storage for numpy array
        self.shape = shape
        self.dtype = dtype
        self.base = mp.RawArray(c_type, int(num_elems))
        self.lock = mp.RLock()

    #overloaded operators for convienince
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号