Files
BobRandomNumber-ComfyUI-TLBVFI/TLBVFI/model/utils.py
T
2025-08-04 18:50:22 -04:00

18 lines
323 B
Python

from inspect import isfunction
def extract(a, t, x_shape):
b, *_ = t.shape
out = a.gather(-1, t)
return out.reshape(b, *((1,) * (len(x_shape) - 1)))
def exists(x):
return x is not None
def default(val, d):
if exists(val):
return val
return d() if isfunction(d) else d