mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-11-19 22:25:44 +08:00
Add KPlanesEncoding encoding (#1658)
Co-authored-by: gmeanti <giacomo.meanti@gmail.com>
This commit is contained in:
1 parent
e6ee0292e0
commit
78fbe6513e
2 files changed
+109
-2
No files matched your search
@@ -171,6 +171,32 @@ def test_tensor_hash_encoder():
|
||||
assert encoded.shape == (10, out_dim)
|
||||
|
||||
|
||||
def test_kplane_encoder():
|
||||
"""Test K-Planes encoder"""
|
||||
|
||||
out_dim = 8
|
||||
|
||||
encoder = encodings.KPlanesEncoding(
|
||||
resolution=(32, 32, 32, 16),
|
||||
num_components=out_dim,
|
||||
reduce="product",
|
||||
)
|
||||
assert encoder.get_out_dim() == out_dim
|
||||
|
||||
in_tensor = torch.randn((10, 4))
|
||||
encoded = encoder(in_tensor)
|
||||
assert encoded.shape == (10, out_dim)
|
||||
|
||||
encoder = encodings.KPlanesEncoding(
|
||||
resolution=(32, 32, 32),
|
||||
num_components=out_dim,
|
||||
reduce="product",
|
||||
)
|
||||
in_tensor = torch.randn((10, 3))
|
||||
encoded = encoder(in_tensor)
|
||||
assert encoded.shape == (10, out_dim)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
test_scaling_and_offset()
|
||||
test_nerf_encoder()
|
||||
|
||||
Reference in new issue
Block a user