我的代码如下:
@ti.data_oriented
class test:
D:ti.f64
def __init__(self):
self.D = ti.math.nan
@ti.func
def f(self):
self.D = 1
@ti.kernel
def q():
t = test()
print(t.D)
t.f()
print(t.D)
q()
代码运行结果如下:
self.D = 1
^^^^^^^^^^
Variable 'self.D' cannot be assigned. Maybe it is not a Taichi object?
请问各位大佬,这里为什么不能给test类中的变量D赋值?