mitsuba-renderer / drjit

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

Support for indexing into zero-dim tensor #283

Closed rtabbara closed 2 months ago

rtabbara commented 2 months ago

A common pattern in the Mitsuba tutorials is to perform a reduction on a tensor across all axes and then fetch the single scalar value. e.g.

# TensorXf type of shape=()
y = dr.mean(tensor, axis=None)

# Scalar type
x = y[0]

The PR adds this feature to zero-index into these tensors. Note, that for consistency compatible slices (e.g. y[-1]) are also still valid and slice assignment is additionally supported.

rtabbara commented 2 months ago

After further discussions, we've decided this isn't a necessary feature