You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following code silently produces a result value of 0, instead of 1 as it should. If I remove the if-statement, it works as expected. I tried adding dr.hint(..., exclude=[b]), but that produces an error RuntimeError: ad_traverse(): tried to forward-propagate derivatives across edge a1 -> a2, which lies outside of the current dr.isolate_grad() scope.
It's not entirely clear what's the right pattern is to get correct results here. I guess one option is to explicitly forward-propagate up to right before the if-conditioned is entered?
importdrjitasdrimportmitsubaasmimi.set_variant('llvm_ad_rgb')
@dr.syntax(print_code=True)deff():
param=mi.Float(0.0)
dr.enable_grad(param)
dr.set_grad(param, 1.0)
a=dr.linspace(mi.Float, 1, 2, 16) +paramresult=mi.Float(0.0)
b=dr.gather(mi.Float, a, 3)
# dr.forward_to(b) # One option is to explicitly propagate up to ifb==b: # Always trueresult+=dr.forward_to(b) # Fails silently# Doing the same without the if-statement works as expected# result += dr.forward_to(b)returnresultresult=f()
print(result)
The text was updated successfully, but these errors were encountered:
Separating this from issue #253
The following code silently produces a result value of 0, instead of 1 as it should. If I remove the if-statement, it works as expected. I tried adding dr.hint(..., exclude=[b]), but that produces an error RuntimeError: ad_traverse(): tried to forward-propagate derivatives across edge a1 -> a2, which lies outside of the current dr.isolate_grad() scope.
It's not entirely clear what's the right pattern is to get correct results here. I guess one option is to explicitly forward-propagate up to right before the if-conditioned is entered?
The text was updated successfully, but these errors were encountered: