Open ailzhang opened 1 year ago
This is also very nice if you're doing any "metaprogramming" with ti.template()
, for example if I pass the ExampleModule to some other data_oriented class as a ti.template()
- it can then call back my some_kernel()
which can access a
.
I don't think there's any other way of doing this right now (and it works very nicely if a
is a field
)
@jim19930609
Users from
ti.field
might easily write something like below but taichi will complain about missing arg annotation forself.a
such that struct-for will fail. I guess we could either provide a best practice for users about how to work around this (like passing in self.a as an arg with proper annotation), or think about a way how users can annotateself
properly so that they don't have to annotate member ndarrays in each kernel one by one. This is kinda similar to the idea what users ask for asargpack
IMHO.