mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-12-03 22:38:48 +08:00
nerf-w and semantic-nerf initial implementations (#73)
* initial nerfw code * nerfw should be implmented correctly now * semantic nerf in progress. data loader is too slow and not clean right now * added implementation of semantic nerf * mend
This commit is contained in:
1 parent
97c9fe2541
commit
1c1a58c4e5
22 files changed
+725
-92
No files matched your search
@@ -0,0 +1,30 @@
|
||||
"""
|
||||
Code for embeddings.
|
||||
"""
|
||||
|
||||
|
||||
import torch
|
||||
from torchtyping import TensorType
|
||||
from mattport.nerf.field_modules.base import FieldModule
|
||||
|
||||
|
||||
class Embedding(FieldModule):
|
||||
"""Index into embeddings."""
|
||||
|
||||
def __init__(self, in_dim: int, out_dim: int) -> None:
|
||||
"""
|
||||
Args:
|
||||
in_dim (int): Number of embeddings
|
||||
out_dim (int): Dimension of the embedding vectors
|
||||
"""
|
||||
super().__init__()
|
||||
self.in_dim = in_dim
|
||||
self.out_dim = out_dim
|
||||
self.build_nn_modules()
|
||||
|
||||
def build_nn_modules(self) -> None:
|
||||
self.embedding = torch.nn.Embedding(self.in_dim, self.out_dim)
|
||||
|
||||
def forward(self, in_tensor: TensorType[..., "input_dim"]) -> TensorType[..., "output_dim"]:
|
||||
"""Call forward"""
|
||||
return self.embedding(in_tensor)
|
||||
Reference in new issue
Block a user