Add more tests

This commit is contained in:
Matt Tancik committed 2022-04-14 17:46:35 -07:00
1 parent 03738b1066
commit 469fd08cee
2 files changed
+42 -3

No files matched your search

+4 -3
View File
@@ -12,7 +12,7 @@ from mattport.nerf.modules.module import Module
class RenderHead(Module):
"""Base Render head"""
def __init__(self, in_dim: int, out_dim: int, activation: Optional[nn.Module]) -> None:
def __init__(self, in_dim: int, out_dim: int, activation: Optional[nn.Module] = None) -> None:
"""
Args:
in_dim (int): input dimension
@@ -30,6 +30,7 @@ class RenderHead(Module):
layers = [nn.Linear(self.in_dim, self.out_dim)]
if self.activation:
layers.append(self.activation)
print(layers)
self.net = nn.Sequential(*layers)
def forward(self, in_tensor: TensorType[..., "in_dim"]) -> TensorType[..., "out_dim"]:
@@ -49,12 +50,12 @@ class RenderHead(Module):
class DensityHead(RenderHead):
"""Density head"""
def __init__(self, in_dim: int, activation: Optional[nn.Module] = nn.Softplus) -> None:
def __init__(self, in_dim: int, activation: Optional[nn.Module] = nn.Softplus()) -> None:
super().__init__(in_dim, 1, activation)
class RGBHead(RenderHead):
"""RGB head"""
def __init__(self, in_dim: int, activation: Optional[nn.Module] = nn.Sigmoid) -> None:
def __init__(self, in_dim: int, activation: Optional[nn.Module] = nn.Sigmoid()) -> None:
super().__init__(in_dim, 3, activation)