DDPM අත්දැකීම් සඳහා උපයෝගිතා කාර්යයන්

10import torch.utils.data

සිතියම්හැඩයට විශේෂාංග කිරීමට සහ නැවත සකස් කිරීම සඳහා ගැටුම් එක්රැස් කරන්න

13def gather(consts: torch.Tensor, t: torch.Tensor):
15    c = consts.gather(-1, t)
16    return c.reshape(-1, 1, 1, 1)