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

Method __init__

SRGAN/models.py:34–39  ·  view source on GitHub ↗
(self,in_channels,scale_factor)

Source from the content-addressed store, hash-verified

32#采用PixelShuffle进行上采样
33class UpsampleBlock(torch.nn.Module):
34 def __init__(self,in_channels,scale_factor):
35 super(UpsampleBlock, self).__init__()
36 self.conv = torch.nn.Conv2d(in_channels,in_channels*scale_factor**2,kernel_size = (3,3),stride = (1,1),padding=(1,1))
37 #(in_channels * 4,H,W) => (in_channels,H*2,W*2)
38 self.ps = torch.nn.PixelShuffle(scale_factor)
39 self.act = torch.nn.PReLU(num_parameters=in_channels)
40 def forward(self,x):
41 out = self.act(self.ps(self.conv(x)))
42 return out

Callers

nothing calls this directly

Calls 1

__init__Method · 0.45

Tested by

no test coverage detected