MCPcopy Index your code
hub / github.com/CompVis/diff2flow / convert_fm_t_to_dm_t

Method convert_fm_t_to_dm_t

diff2flow/flow_obj.py:103–118  ·  view source on GitHub ↗

Convert the continuous time t in [0,1] to discrete time t [0, 1000] # TODO: Make it compatible with zero-terminal SNR

(self, t)

Source from the content-addressed store, hash-verified

101 return vector_field
102
103 def convert_fm_t_to_dm_t(self, t):
104 """
105 Convert the continuous time t in [0,1] to discrete time t [0, 1000]
106 # TODO: Make it compatible with zero-terminal SNR
107 """
108 rectified_alphas_cumprod_full = self.rectified_alphas_cumprod_full.clone().to(t.device)
109 # reverse the rectified_alphas_cumprod_full for searchsorted
110 rectified_alphas_cumprod_full = torch.flip(rectified_alphas_cumprod_full, [0])
111 right_index = torch.searchsorted(rectified_alphas_cumprod_full, t, right=True)
112 left_index = right_index - 1
113 right_value = rectified_alphas_cumprod_full[right_index]
114 left_value = rectified_alphas_cumprod_full[left_index]
115 dm_t = left_index + (t - left_value) / (right_value - left_value)
116 # now reverse back the dm_t
117 dm_t = self.num_timesteps - dm_t
118 return dm_t
119
120 def convert_fm_xt_to_dm_xt(self, fm_xt, fm_t):
121 """

Callers 2

sample_vtMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected