Код: Выделить всё
# simple jitted functions defined in another file
@njit
def my_function(x):
x = x + 1
return x
@njit
def another_function(x):
x = x * 2
return x
Код: Выделить всё
spec = [('attribute', ???),
('value', float32)]
@jitclass(spec)
class Myclass:
def __init__(self, fun):
self.attribute = fun
def class_fun(self, x):
value = self.attribute(x)
return value
Код: Выделить всё
new_object = Myclass(fun=another_function)
new_object.class_fun(2)
Код: Выделить всё
Failed in nopython mode pipeline (step: nopython mode backend)
Cannot cast type(CPUDispatcher())
to type(CPUDispatcher())
Кто-нибудь знает способ, позволяющий передавать любые jitted-функции? функция при создании объекта jitclass Myclass?
Подробнее здесь: https://stackoverflow.com/questions/669 ... d-function