【发布时间】:2015-03-31 02:53:05
【问题描述】:
我可以在 0.6 numba 文档中找到一些关于如何使用 numba on classes 的信息:
from numba import jit, void, int_, double
# All methods must be given signatures
@jit
class Shrubbery(object):
@void(int_, int_)
def __init__(self, w, h):
# All instance attributes must be defined in the initializer
self.width = w
self.height = h
# Types can be explicitly specified through casts
self.some_attr = double(1.0)
@int_()
def area(self):
return self.width * self.height
@void()
def describe(self):
print("This shrubbery is ", self.width,
"by", self.height, "cubits.")
但我在0.16 documentation 中找不到。是否总是可以在类上使用 numba ?
【问题讨论】:
标签: python-3.x numba