MCPcopy Create free account
hub / github.com/VisionXLab/OF-Diff / get_weighting

Method get_weighting

ldm/models/diffusion/ddpm.py:706–720  ·  view source on GitHub ↗
(self, h, w, Ly, Lx, device)

Source from the content-addressed store, hash-verified

704 return edge_dist
705
706 def get_weighting(self, h, w, Ly, Lx, device):
707 weighting = self.delta_border(h, w)
708 weighting = torch.clip(weighting, self.split_input_params["clip_min_weight"],
709 self.split_input_params["clip_max_weight"], )
710 weighting = weighting.view(1, h * w, 1).repeat(1, 1, Ly * Lx).to(device)
711
712 if self.split_input_params["tie_braker"]:
713 L_weighting = self.delta_border(Ly, Lx)
714 L_weighting = torch.clip(L_weighting,
715 self.split_input_params["clip_min_tie_weight"],
716 self.split_input_params["clip_max_tie_weight"])
717
718 L_weighting = L_weighting.view(1, 1, Ly * Lx).to(device)
719 weighting = weighting * L_weighting
720 return weighting
721
722 def get_fold_unfold(self, x, kernel_size, stride, uf=1, df=1): # todo load once not every time, shorten code
723 """

Callers 1

get_fold_unfoldMethod · 0.95

Calls 1

delta_borderMethod · 0.95

Tested by

no test coverage detected