mitsuba-renderer / drjit

Dr.Jit — A Just-In-Time-Compiler for Differentiable Rendering
BSD 3-Clause "New" or "Revised" License
563 stars 40 forks source link

An error code but no exception is reported #231

Closed ioissss closed 2 months ago

ioissss commented 2 months ago

I've been doing some experiments with the mitsuba3 library, and when I include the statement active_em &= (ds.pdf!=0) in my code, it causes my code to fail to get results, but there are no runtime errors or exceptions.

active_em = mi.Bool(True)
active_em &= (ds.pdf!=0)

Is there a problem with this usage and what are the alternatives? I've tried this:

active_em = mi.Bool(True)
active_em &= (dr.select(ds.pdf != 0, True, False))

but it dose not work

njroussel commented 2 months ago

Hi @ioissss

Vectorized equality and inequality comparisons should be done with dr.eq(a, b) and dr.neq(a, b) respectively. All other comparisons use the typical operands.

This will be changing in the next release where you'll able to use the == and != operands as you have in your code snippet.