google-research / multinerf

A Code Release for Mip-NeRF 360, Ref-NeRF, and RawNeRF
Apache License 2.0
3.57k stars 338 forks source link

Fix TracerArrayConversionError when Config.cast_rays_in_train_step=True #62

Closed onpix closed 1 year ago

onpix commented 1 year ago

When setting Config.cast_rays_in_train_step = True, the ray batches for training are sampled in train_step. i.e., the runtime numpy should be jax.numpy. However, the argument xnp is not passed to the function convert_to_ndc, which causes the error like:

jax._src.errors.TracerArrayConversionError: The numpy.ndarray conversion method  __array__() was called on the JAX Tracer object Traced<ShapedArray(float32[204
8,1,1])>with<DynamicJaxprTrace(level=0/1)>
google-cla[bot] commented 1 year ago

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

jonbarron commented 1 year ago

Good catch, and thanks for the CL! I'll merge this in once you sign the CLA.

onpix commented 1 year ago

Good catch, and thanks for the CL! I'll merge this in once you sign the CLA.

Thanks for your reply! I have signed the CLA now.