mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-11-14 11:54:01 +08:00
Do not materialize mlp_head if no field_heads (#2457)
In case it is used in a proposal network we avoid initializing the head. Co-authored-by: Matthew Tancik <matt@lumalabs.ai>
This commit is contained in:
1 parent
2fd8b59d20
commit
52f26e82b3
1 file changed
+8
-8
@@ -74,15 +74,15 @@ class NeRFField(Field):
|
||||
skip_connections=skip_connections,
|
||||
out_activation=nn.ReLU(),
|
||||
)
|
||||
|
||||
self.mlp_head = MLP(
|
||||
in_dim=self.mlp_base.get_out_dim() + self.direction_encoding.get_out_dim(),
|
||||
num_layers=head_mlp_num_layers,
|
||||
layer_width=head_mlp_layer_width,
|
||||
out_activation=nn.ReLU(),
|
||||
)
|
||||
|
||||
self.field_output_density = DensityFieldHead(in_dim=self.mlp_base.get_out_dim())
|
||||
|
||||
if field_heads:
|
||||
self.mlp_head = MLP(
|
||||
in_dim=self.mlp_base.get_out_dim() + self.direction_encoding.get_out_dim(),
|
||||
num_layers=head_mlp_num_layers,
|
||||
layer_width=head_mlp_layer_width,
|
||||
out_activation=nn.ReLU(),
|
||||
)
|
||||
self.field_heads = nn.ModuleList([field_head() for field_head in field_heads] if field_heads else []) # type: ignore
|
||||
for field_head in self.field_heads:
|
||||
field_head.set_in_dim(self.mlp_head.get_out_dim()) # type: ignore
|
||||
|
||||
Reference in new issue
Block a user