MCPcopy Create free account
hub / github.com/Zhiyuan-R/Tiger-Diffusion / get_constrain_function

Function get_constrain_function

test_generation.py:361–376  ·  view source on GitHub ↗

:param target_shape_constraint: target voxels :return: constrained x

(ground_truth, mask, eps, num_steps=1)

Source from the content-addressed store, hash-verified

359 return betas
360
361def get_constrain_function(ground_truth, mask, eps, num_steps=1):
362 '''
363
364 :param target_shape_constraint: target voxels
365 :return: constrained x
366 '''
367 # eps_all = list(reversed(np.linspace(0,np.float_power(eps, 1/2), 500)**2))
368 eps_all = list(reversed(np.linspace(0, np.sqrt(eps), 1000)**2 ))
369 def constrain_fn(x, t):
370 eps_ = eps_all[t] if (t<1000) else 0
371 for _ in range(num_steps):
372 x = x - eps_ * ((x - ground_truth) * mask)
373
374
375 return x
376 return constrain_fn
377
378
379#############################################################################

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected