| 10 | #输出为: [1,28,28]图片 |
| 11 | |
| 12 | class 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 |
nothing calls this directly
no outgoing calls
no test coverage detected