mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-12-02 13:59:10 +08:00
1 parent
12786b0ef9
commit
ea1de7fa2c
1 file changed
+20
-9
@@ -13,19 +13,30 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
"""CUDA Functions"""
|
"""CUDA Functions"""
|
||||||
|
from typing import Callable
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
from torch.cuda.amp import custom_bwd, custom_fwd
|
from torch.cuda.amp import custom_bwd, custom_fwd
|
||||||
|
|
||||||
from nerfactory.cuda.backend import _C
|
|
||||||
|
|
||||||
packbits = _C.packbits
|
def _make_lazy_cuda(name: str) -> Callable:
|
||||||
ray_aabb_intersect = _C.ray_aabb_intersect
|
def call_cuda(*args, **kwargs):
|
||||||
morton3D = _C.morton3D
|
# pylint: disable=import-outside-toplevel
|
||||||
morton3D_invert = _C.morton3D_invert
|
from nerfactory.cuda.backend import _C
|
||||||
raymarching = _C.raymarching
|
|
||||||
volumetric_rendering_forward = _C.volumetric_rendering_forward
|
return getattr(_C, name)(*args, **kwargs)
|
||||||
volumetric_rendering_backward = _C.volumetric_rendering_backward
|
|
||||||
occupancy_query = _C.occupancy_query
|
return call_cuda
|
||||||
|
|
||||||
|
|
||||||
|
packbits = _make_lazy_cuda("packbits")
|
||||||
|
ray_aabb_intersect = _make_lazy_cuda("ray_aabb_intersect")
|
||||||
|
morton3D = _make_lazy_cuda("morton3D")
|
||||||
|
morton3D_invert = _make_lazy_cuda("morton3D_invert")
|
||||||
|
raymarching = _make_lazy_cuda("raymarching")
|
||||||
|
volumetric_rendering_forward = _make_lazy_cuda("volumetric_rendering_forward")
|
||||||
|
volumetric_rendering_backward = _make_lazy_cuda("volumetric_rendering_backward")
|
||||||
|
occupancy_query = _make_lazy_cuda("occupancy_query")
|
||||||
|
|
||||||
# pylint: disable=abstract-method,arguments-differ
|
# pylint: disable=abstract-method,arguments-differ
|
||||||
class VolumeRenderer(torch.autograd.Function):
|
class VolumeRenderer(torch.autograd.Function):
|
||||||
|
|||||||
Reference in new issue
Block a user