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

Function _gaussian_blur2d

train.py:320–333  ·  view source on GitHub ↗
(input, kernel_size, sigma)

Source from the content-addressed store, hash-verified

318
319
320def _gaussian_blur2d(input, kernel_size, sigma):
321 if isinstance(sigma, tuple):
322 sigma = torch.tensor([sigma], dtype=input.dtype)
323 else:
324 sigma = sigma.to(dtype=input.dtype)
325
326 ky, kx = int(kernel_size[0]), int(kernel_size[1])
327 bs = sigma.shape[0]
328 kernel_x = _gaussian(kx, sigma[:, 1].view(bs, 1))
329 kernel_y = _gaussian(ky, sigma[:, 0].view(bs, 1))
330 out_x = _filter2d(input, kernel_x[..., None, :])
331 out = _filter2d(out_x, kernel_y[..., None])
332
333 return out
334
335
336def 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