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

Class Generator

GANCode/gModel.py:12–26  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10#输出为: [1,28,28]图片
11
12class Generator(torch.nn.Module):
13 def __init__(self):
14 super(Generator, self).__init__()
15 self.fc = torch.nn.Sequential(
16 torch.nn.Linear(in_features=100,out_features=256),
17 torch.nn.ReLU(),
18 torch.nn.Linear(in_features=256,out_features=512),
19 torch.nn.ReLU(),
20 torch.nn.Linear(in_features=512,out_features=784),
21 torch.nn.Tanh()#对于生成器使用tanh激活函数更好
22 )
23 def forward(self,input):
24 x = self.fc(input)
25 img = x.view(-1,28,28)
26 return img

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected