import taichi as ti
ti.init(arch=ti.gpu)
img = ti.field( ti.i32, (2,2))
@ti.kernel
def K():
for i,j in img:
img[i,j] = 0
if i> 0 or j> 0:continue
img[i,j] = 1
for i,j in img:
print(i,j,img[i,j])
img.fill(2)
K()
它的输出如下
img[i,j] = 0 这句就像没有作用一样
或者是continue不能这样用?