mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-11-19 22:25:44 +08:00
Add tensor CP encoding (#72)
This commit is contained in:
1 parent
6a70eaa40a
commit
97c9fe2541
2 files changed
+77
-2
No files matched your search
@@ -75,7 +75,30 @@ def test_tensor_vm_encoder():
|
||||
out_dim = 3 * num_components
|
||||
|
||||
encoder = encoding.TensorVMEncoding(num_components=num_components, resolution=resolution)
|
||||
assert encoder.get_out_dim() == num_components * 3
|
||||
assert encoder.get_out_dim() == out_dim
|
||||
|
||||
in_tensor = torch.ones((3, in_dim))
|
||||
encoded = encoder.encode(in_tensor)
|
||||
assert encoded.shape == (3, out_dim)
|
||||
|
||||
in_tensor = torch.ones((6, 3, in_dim))
|
||||
encoded = encoder.encode(in_tensor)
|
||||
assert encoded.shape == (6, 3, out_dim)
|
||||
|
||||
encoder.upsample_grid(resolution=64)
|
||||
|
||||
|
||||
def test_tensor_cp_encoder():
|
||||
"""Test TensorCP encoder"""
|
||||
|
||||
num_components = 24
|
||||
resolution = 32
|
||||
|
||||
in_dim = 3
|
||||
out_dim = num_components
|
||||
|
||||
encoder = encoding.TensorCPEncoding(num_components=num_components, resolution=resolution)
|
||||
assert encoder.get_out_dim() == out_dim
|
||||
|
||||
in_tensor = torch.ones((3, in_dim))
|
||||
encoded = encoder.encode(in_tensor)
|
||||
@@ -93,3 +116,4 @@ if __name__ == "__main__":
|
||||
test_nerf_encoder()
|
||||
test_rff_encoder()
|
||||
test_tensor_vm_encoder()
|
||||
test_tensor_cp_encoder()
|
||||
Reference in new issue
Block a user