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

Method convert_fm_xt_to_dm_xt

diff2flow/flow_obj.py:120–136  ·  view source on GitHub ↗

Convert fm trajectory to dm trajectory using the fm t We use linear scaling here

(self, fm_xt, fm_t)

Source from the content-addressed store, hash-verified

118 return dm_t
119
120 def convert_fm_xt_to_dm_xt(self, fm_xt, fm_t):
121 """
122 Convert fm trajectory to dm trajectory using the fm t
123 We use linear scaling here
124 """
125 scale = self.sqrt_alphas_cumprod_full + self.sqrt_one_minus_alphas_cumprod_full
126 dm_t = self.convert_fm_t_to_dm_t(fm_t)
127 # do lienar interpolation here
128 dm_t_left_index = torch.floor(dm_t)
129 dm_t_right_index = torch.ceil(dm_t)
130 dm_t_left_value = scale[dm_t_left_index.long()]
131 dm_t_right_value = scale[dm_t_right_index.long()]
132
133 scale_t = dm_t_left_value + (dm_t - dm_t_left_index) * (dm_t_right_value - dm_t_left_value)
134 scale_t = scale_t.view(-1, 1, 1, 1)
135 dm_xt = fm_xt * scale_t
136 return dm_xt
137
138 def predict_start_from_z_and_v(self, x_t, t, v):
139 return (

Callers 1

sample_vtMethod · 0.95

Calls 1

convert_fm_t_to_dm_tMethod · 0.95

Tested by

no test coverage detected