MCPcopy Create free account
hub / github.com/DSL-Lab/StreamSplat / key_activation

Method key_activation

model/model_utils.py:434–448  ·  view source on GitHub ↗

Apply activation functions for dynamic keys.

(self, v: torch.Tensor, key='')

Source from the content-addressed store, hash-verified

432
433 @autocast('cuda', enabled=False)
434 def key_activation(self, v: torch.Tensor, key=''):
435 """
436 Apply activation functions for dynamic keys.
437 """
438 v = v.type(torch.float32)
439 if key == "xyz_dynamic":
440 v = F.tanh(v).reshape(*v.shape[:2], -1, 3)
441 v = v * torch.tensor([0.5, 0.1, 0.5]).to(v.device)
442 v = v * self.dynamic_scalar
443 elif key == "opacity_dynamic":
444 v[..., 0] = torch.relu(v[..., 0]) # scalar
445 v[..., 1] = torch.sigmoid(v[..., 1]) # t
446 else:
447 raise NotImplementedError
448 return v
449
450class GSPredictor(nn.Module):
451 def __init__(self, opt: Options, **model_kwargs):

Callers 1

forwardMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected