会出现这个警告:
UserWarning: Calling non-taichi function "b.f".
Scope inside the function is not processed by the Taichi AST transformer.
The function may not work as expected.
Proceed with caution! Maybe you can consider turning it into a @ti.func?
b.f()
我的代码如下:
@ti.data_oriented
class test:
D:ti.f64
def __init__(self):
self.D = ti.math.nan
# @ti.func
def f(self):
self.D = 1
return self.D
@ti.kernel
def q(b:ti.template()):
b.f()
a = test()
q(a)
这个功能对我的一个项目很重要,非常感谢各位大佬看看,希望不吝赐教!