MCPcopy Create free account
hub / github.com/Francis-Rings/StableAnimator / _gaussian_blur2d

Function _gaussian_blur2d

train_single.py:324–337  ·  view source on GitHub ↗
(input, kernel_size, sigma)

Source from the content-addressed store, hash-verified

322
323
324def _gaussian_blur2d(input, kernel_size, sigma):
325 if isinstance(sigma, tuple):
326 sigma = torch.tensor([sigma], dtype=input.dtype)
327 else:
328 sigma = sigma.to(dtype=input.dtype)
329
330 ky, kx = int(kernel_size[0]), int(kernel_size[1])
331 bs = sigma.shape[0]
332 kernel_x = _gaussian(kx, sigma[:, 1].view(bs, 1))
333 kernel_y = _gaussian(ky, sigma[:, 0].view(bs, 1))
334 out_x = _filter2d(input, kernel_x[..., None, :])
335 out = _filter2d(out_x, kernel_y[..., None])
336
337 return out
338
339
340def export_to_video(video_frames, output_video_path, fps):

Callers 1

Calls 2

_gaussianFunction · 0.70
_filter2dFunction · 0.70

Tested by

no test coverage detected