mitsuba-renderer / drjit

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

Fixed tensor initialization creating opaque #277

Closed DoeringChristian closed 1 week ago

DoeringChristian commented 1 week ago

Fixes #267 by moving the is_builtin check and not using ravel when input is a single variable.

merlinND commented 1 week ago

@wjakob I just now realize that dr.ravel() has also changed at a user-visible level, just checking that it's the intended behavior?

DrJit 0.4.4:

>>> import drjit as dr
>>> a = dr.ravel(2)
>>> a
2
>>> type(a)
<class 'int'>

Upcoming DrJit:

>>> import drjit as dr
>>> a = dr.ravel(2)
>>> a
[2]
>>> type(a)
<class 'drjit.scalar.ArrayXf'>
>>> type(a[0])
<class 'float'>

So my int became an ArrayXf, which contains a float.

DoeringChristian commented 1 week ago

I just verified, that reverting the behavior of dr.ravel also fixes the regression and is compliant with all tests.

wjakob commented 1 week ago

This behavior of dr.ravel seems undesirable to me. Not sure why it does that.

merlinND commented 1 week ago

Thanks for checking @DoeringChristian, could you please update this PR or open another with your changes that fix dr.ravel()? If you have a minute, could you please also add / update a unit test to catch the dr.ravel() problem shown above?

wjakob commented 1 week ago

LGTM!