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

Function get_expon_lr_func

utils/general_utils.py:32–65  ·  view source on GitHub ↗

Copied from Plenoxels Continuous learning rate decay function. Adapted from JaxNeRF The returned rate is lr_init when step=0 and lr_final when step=max_steps, and is log-linearly interpolated elsewhere (equivalent to exponential decay). If lr_delay_steps>0 then the learning rat

(
    lr_init, lr_final, lr_delay_steps=0, lr_delay_mult=1.0, max_steps=1000000
)

Source from the content-addressed store, hash-verified

30 return resized_image.unsqueeze(dim=-1).permute(2, 0, 1)
31
32def get_expon_lr_func(
33 lr_init, lr_final, lr_delay_steps=0, lr_delay_mult=1.0, max_steps=1000000
34):
35 """
36 Copied from Plenoxels
37
38 Continuous learning rate decay function. Adapted from JaxNeRF
39 The returned rate is lr_init when step=0 and lr_final when step=max_steps, and
40 is log-linearly interpolated elsewhere (equivalent to exponential decay).
41 If lr_delay_steps>0 then the learning rate will be scaled by some smooth
42 function of lr_delay_mult, such that the initial learning rate is
43 lr_init*lr_delay_mult at the beginning of optimization but will be eased back
44 to the normal learning rate when steps>lr_delay_steps.
45 :param conf: config subtree 'lr' or similar
46 :param max_steps: int, the number of steps during optimization.
47 :return HoF which takes step as input
48 """
49
50 def helper(step):
51 if step < 0 or (lr_init == 0.0 and lr_final == 0.0):
52 # Disable this parameter
53 return 0.0
54 if lr_delay_steps > 0:
55 # A kind of reverse cosine decay.
56 delay_rate = lr_delay_mult + (1 - lr_delay_mult) * np.sin(
57 0.5 * np.pi * np.clip(step / lr_delay_steps, 0, 1)
58 )
59 else:
60 delay_rate = 1.0
61 t = np.clip(step / max_steps, 0, 1)
62 log_lerp = np.exp(np.log(lr_init) * (1 - t) + np.log(lr_final) * t)
63 return delay_rate * log_lerp
64
65 return helper
66
67def strip_lowerdiag(L):
68 uncertainty = torch.zeros((L.shape[0], 6), dtype=torch.float, device="cuda")

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected