MCPcopy Create free account
hub / github.com/bingchenlll/FastGAN-pytorch / NoiseInjection

Class NoiseInjection

models.py:55–66  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

53
54
55class NoiseInjection(nn.Module):
56 def __init__(self):
57 super().__init__()
58
59 self.weight = nn.Parameter(torch.zeros(1), requires_grad=True)
60
61 def forward(self, feat, noise=None):
62 if noise is None:
63 batch, _, height, width = feat.shape
64 noise = torch.randn(batch, 1, height, width).to(feat.device)
65
66 return feat + self.weight * noise
67
68
69class Swish(nn.Module):

Callers 1

UpBlockCompFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected