MCPcopy Create free account
hub / github.com/KeepTryingTo/Pytorch-GAN / minibatch_std

Method minibatch_std

ProGAN/model.py:198–205  ·  view source on GitHub ↗
(self, x)

Source from the content-addressed store, hash-verified

196 return alpha * out + (1 - alpha) * downscaled
197
198 def minibatch_std(self, x):
199 batch_statistics = (
200 torch.std(x, dim=0).mean().repeat(x.shape[0], 1, x.shape[2], x.shape[3])
201 )
202 # we take the std for each example (across all channels, and pixels) then we repeat it
203 # for a single channel and concatenate it with the image. In this way the discriminator
204 # will get information about the variation in the batch/image
205 return torch.cat([x, batch_statistics], dim=1)
206
207 def forward(self, x, alpha, steps):
208 # where we should start in the list of prog_blocks, maybe a bit confusing but

Callers 1

forwardMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected