MCPcopy Create free account
hub / github.com/NVlabs/InstantSplat / ParameterStack

Function ParameterStack

dust3r/cloud_opt/optimizer.py:214–228  ·  view source on GitHub ↗
(params, keys=None, is_param=None, fill=0)

Source from the content-addressed store, hash-verified

212
213
214def ParameterStack(params, keys=None, is_param=None, fill=0):
215 if keys is not None:
216 params = [params[k] for k in keys]
217
218 if fill > 0:
219 params = [_ravel_hw(p, fill) for p in params]
220
221 requires_grad = params[0].requires_grad
222 assert all(p.requires_grad == requires_grad for p in params)
223
224 params = torch.stack(list(params)).float().detach()
225 if is_param or requires_grad:
226 params = nn.Parameter(params)
227 params.requires_grad_(requires_grad)
228 return params
229
230
231def _ravel_hw(tensor, fill=0):

Callers 1

__init__Method · 0.85

Calls 1

_ravel_hwFunction · 0.85

Tested by

no test coverage detected