mirror of
https://github.com/facebookresearch/pytorch3d.git
synced 2025-08-02 03:42:50 +08:00
Avoid temporary arrays in _check_density_bounds
Summary: We can check the bounds without using extra memory. This produces a small speedup in NeRF training (like 0.5%). Reviewed By: nikhilaravi Differential Revision: D27859691 fbshipit-source-id: d566420c465f51231f4a57438084c98b73253046
This commit is contained in:
parent
04d318d88f
commit
b538f10796
@ -177,12 +177,12 @@ def _check_density_bounds(
|
||||
Checks whether the elements of `rays_densities` range within `bounds`.
|
||||
If not issues a warning.
|
||||
"""
|
||||
# pyre-fixme[16]: `ByteTensor` has no attribute `any`.
|
||||
if ((rays_densities > bounds[1]) | (rays_densities < bounds[0])).any():
|
||||
warnings.warn(
|
||||
"One or more elements of rays_densities are outside of valid"
|
||||
+ f"range {str(bounds)}"
|
||||
)
|
||||
with torch.no_grad():
|
||||
if (rays_densities.max() > bounds[1]) or (rays_densities.min() < bounds[0]):
|
||||
warnings.warn(
|
||||
"One or more elements of rays_densities are outside of valid"
|
||||
+ f"range {str(bounds)}"
|
||||
)
|
||||
|
||||
|
||||
def _check_raymarcher_inputs(
|
||||
|
Loading…
x
Reference in New Issue
Block a user