| 65 | |
| 66 | #摆脱输入向量z受输入数据集分布的影响,更好的实现属性解耦合 |
| 67 | class MappingNetwork(torch.nn.Module): |
| 68 | def __init__(self,z_dim,w_dim): |
| 69 | super(MappingNetwork, self).__init__() |
| 70 | self.mapping = torch.nn.Sequential( |
| 71 | PixelNorm(), |
| 72 | WSLinear(z_dim,w_dim), |
| 73 | torch.nn.ReLU(), |
| 74 | WSLinear(w_dim, w_dim), |
| 75 | torch.nn.ReLU(), |
| 76 | WSLinear(w_dim, w_dim), |
| 77 | torch.nn.ReLU(), |
| 78 | WSLinear(w_dim, w_dim), |
| 79 | torch.nn.ReLU(), |
| 80 | WSLinear(w_dim, w_dim), |
| 81 | torch.nn.ReLU(), |
| 82 | WSLinear(w_dim, w_dim), |
| 83 | torch.nn.ReLU(), |
| 84 | WSLinear(w_dim, w_dim), |
| 85 | torch.nn.ReLU(), |
| 86 | WSLinear(w_dim, w_dim), |
| 87 | ) |
| 88 | def forward(self,x): |
| 89 | return self.mapping(x) |
| 90 | |
| 91 | #注入到网络中的噪声 |
| 92 | class InjectNoise(torch.nn.Module): |