difftaichi icon indicating copy to clipboard operation
difftaichi copied to clipboard

how to fix field(s) are not placed error

Open yangyichu opened this issue 4 years ago • 3 comments

So I'm trying to run the examples yet many of the examples throw the error as shown below:(diffmpm as an example) File "diffmpm.py", line 386, in main() File "diffmpm.py", line 348, in main weights[i, j] = np.random.randn() * 0.01 ... RuntimeError: These field(s) are not placed: File "diffmpm.py", line 32, in actuator_id = ti.field(ti.i32) File "diffmpm.py", line 33, in particle_type = ti.field(ti.i32) ...............many similar errors................... File "diffmpm.py", line 44, in x_avg = vec()

So I tried to fix these errors by assigning a shape manually (ti.Vector.field(...shape=(xx,xx))), yet some shapes are not very clear to me and takes a lot of work, is there any decent fix of these?

I tried on windows and ubuntu18.04, both have similar issue, my taichi version is 0.7.31.

yangyichu avatar Sep 07 '21 08:09 yangyichu

Hi, @yangyichu , the errors should be sorted after the latest updates, please check the updated "diffmpm.py" :)

erizmr avatar Oct 26 '21 02:10 erizmr

I am using taichi 0.8.9. yet I find those errors in my code, either. I can not fix it...It is very strange as (I think) I'm following the example from the offical docs, but it just reports this error, anyway...

ZiXuanVickyLu avatar Jan 11 '22 05:01 ZiXuanVickyLu

Hi @birepeople , would you mind posting your code so that we can help debug?

BTW, it is also recommended to post any Taichi related questions on this forum: https://forum.taichi.graphics/

erizmr avatar Jan 11 '22 06:01 erizmr