mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-11-13 03:14:00 +08:00
* knocking out a couple * Fix more errors * Add pyright * Remove some unnecessary cv2 type ignores, warning on missing imports (for missing tinycudann) * Minor annotation fixes * Update docs * Drop `None` from temporal distortion output --------- Co-authored-by: Brent Yi <yibrenth@gmail.com>
26 lines
678 B
Python
26 lines
678 B
Python
"""
|
|
Test if temporal distortions run properly
|
|
"""
|
|
import torch
|
|
|
|
from nerfstudio.field_components.temporal_distortions import DNeRFDistortion
|
|
|
|
|
|
def test_dnerf_distortion():
|
|
"""Test dnerf distortion"""
|
|
|
|
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
|
distortion = DNeRFDistortion().to(device)
|
|
|
|
num_rays = 1024
|
|
num_samples = 256
|
|
positions = torch.rand((num_rays, num_samples, 3), dtype=torch.float32, device=device)
|
|
times = torch.rand_like(positions[..., :1])
|
|
out = distortion.forward(positions, times)
|
|
assert out is not None
|
|
assert out.shape == positions.shape
|
|
|
|
|
|
if __name__ == "__main__":
|
|
test_dnerf_distortion()
|