Integrating logic for setting up optimizers in run_train and config files (#33)

* added optimizers

* added optimizer logic for setting it up; todo-- fix optimizers and add step logic

* typing out the alphabet
This commit is contained in:
evonneng authored and GitHub committed 2022-04-21 13:23:18 -07:00
1 parent 4d1a6b2dbd
commit 17d837babf
7 files changed
+59 -24

No files matched your search

+13
View File
@@ -3,6 +3,8 @@ Implementation of vanilla nerf.
"""
from typing import Dict, List
from torch.nn import Parameter
from torchtyping import TensorType
from mattport.nerf.field.nerf import NeRFField
@@ -41,6 +43,17 @@ class NeRFGraph(Graph):
# losses
self.rgb_loss = MSELoss()
def get_param_groups(self) -> Dict[str, List[Parameter]]:
"""Obtain the parameter groups for the optimizers
Returns:
Dict[str, List[Parameter]]: Mapping of different parameter groups
"""
param_groups = {}
param_groups["camera"] = [dict(params=self.ray_generator.parameters())]
param_groups["graph"] = [dict(params=self.field_coarse.parameters()), dict(params=self.field_fine.parameters())]
return param_groups
def forward(self, ray_indices: TensorType["num_rays", 3]):
"""Takes in the ray indices and renders out values."""
# get the rays: