mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-12-02 13:59:10 +08:00
Final typing fixes + add Pyright to CI (#1944)
* 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>
This commit is contained in:
1 parent
08e3a1f1a6
commit
2b0831b6d4
28 files changed
+110
-71
No files matched your search
@@ -15,9 +15,10 @@ def test_dnerf_distortion():
|
||||
num_rays = 1024
|
||||
num_samples = 256
|
||||
positions = torch.rand((num_rays, num_samples, 3), dtype=torch.float32, device=device)
|
||||
assert distortion.forward(positions, None) is None
|
||||
times = torch.rand_like(positions[..., :1])
|
||||
assert distortion.forward(positions, times).shape == positions.shape
|
||||
out = distortion.forward(positions, times)
|
||||
assert out is not None
|
||||
assert out.shape == positions.shape
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
@@ -34,6 +34,7 @@ def test_temporal_grid():
|
||||
weight = torch.randn_like(out)
|
||||
(out * weight).sum().backward()
|
||||
assert torch.all(out == 0.5)
|
||||
assert model.embeddings.grad is not None
|
||||
assert model.embeddings.grad.sum() - weight.sum() < 0.01
|
||||
assert torch.all(model.embeddings.grad[2:, :] == 0)
|
||||
assert torch.all(model.embeddings.grad[:, 1:] == 0)
|
||||
|
||||
Reference in new issue
Block a user