Closed merlinND closed 3 days ago
I've added minor changes and rebased the branch.
Thanks @merlinND :+1:
Sorry I was on holidays last week, thanks a lot for taking over @njroussel!
I had started with variant_change_callbacks
as an nb::object
but ended up downgrading it, I'm not sure why anymore. Probably I wasn't familiar enough with Nanobind to figure it out.
Edit: just saw your comment about nb::object
vs nb::set
, that must be what I ran into.
Awesome, really nice addition!
Description
As discussed with @njroussel.
Currently, upon each variant change, we explicitly reload the custom Python integrators shipped in
mitsuba.python.ad.integrators
. Users don't have access to such a mechanism.By allowing users to register callbacks, they can now implement module loading & reloading for their custom Python plugins. In the future, there may be a higher-level way for users to register plugins that will automatically create such a reload callback.
I also added an alias
scoped_set_variant
tovariant_context
so that it matchesdr.scoped_set_flag()
.Testing
Added a unit test check.
Checklist
cuda_*
andllvm_*
variants. If you can't test this, please leave below