MCPcopy Create free account
hub / github.com/OpenGVLab/DragGAN / NoiseInjection

Class NoiseInjection

draggan/deprecated/stylegan2/model.py:320–331  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

318
319
320class NoiseInjection(nn.Module):
321 def __init__(self):
322 super().__init__()
323
324 self.weight = nn.Parameter(torch.zeros(1))
325
326 def forward(self, image, noise=None):
327 if noise is None:
328 batch, _, height, width = image.shape
329 noise = image.new_empty(batch, 1, height, width).normal_()
330
331 return image + self.weight * noise
332
333
334class ConstantInput(nn.Module):

Callers 1

__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected