mitsuba-renderer / enoki

Enoki: structured vectorization and differentiation on modern processor architectures
Other
1.26k stars 94 forks source link

How to use binary_search overloads in python. #119

Open LeonardEyer opened 3 years ago

LeonardEyer commented 3 years ago

Basically, I want to do this kind of computation:

x = Float.linspace(0, 1, 100)

def f(i : UInt32) -> Mask:
    return ek.gather(x, i) > 0.5

ek.binary_search(0, 100, f)

With Float and UInt32 being cuda arrays. But I get the following error: Unable to cast Python instance of type <class 'enoki.cuda_autodiff.Mask'> to C++ type 'bool' It seems like pybind doesn't choose the correct overloaded method. Am I missing something?