| 5 | from losses import chamfer_distance |
| 6 | |
| 7 | class Discriminator(nn.Module): |
| 8 | def __init__(self): |
| 9 | super(Discriminator, self).__init__() |
| 10 | self.conv1 = nn.Conv2d(4, 32, 4, 2, 1, bias=False) |
| 11 | self.bn1 = nn.BatchNorm2d(32) |
| 12 | self.leakyrelu1 = nn.LeakyReLU(0.2, inplace=True) |
| 13 | |
| 14 | self.conv2 = nn.Conv2d(32, 32, 4, 2, 1, bias=False) |
| 15 | self.bn2 = nn.BatchNorm2d(32) |
| 16 | self.leakyrelu2 = nn.LeakyReLU(0.2, inplace=True) |
| 17 | |
| 18 | self.conv3 = nn.Conv2d(32, 32, 4, 2, 1, bias=False) |
| 19 | self.bn3 = nn.BatchNorm2d(32) |
| 20 | self.leakyrelu3 = nn.LeakyReLU(0.2, inplace=True) |
| 21 | |
| 22 | self.fc = nn.Linear(8192, 1) |
| 23 | self.sigmoid = nn.Sigmoid() |
| 24 | |
| 25 | def forward(self, x): |
| 26 | x = x.permute(0, 3, 1, 2) |
| 27 | x = self.leakyrelu1(self.bn1(self.conv1(x))) |
| 28 | x = self.leakyrelu2(self.bn2(self.conv2(x))) |
| 29 | x = self.leakyrelu3(self.bn3(self.conv3(x))) |
| 30 | x = torch.flatten(x, 1) |
| 31 | x = self.sigmoid(self.fc(x)) |
| 32 | return x |
| 33 | |
| 34 | class model(nn.Module): |
| 35 | def __init__(self, num_basis): |
nothing calls this directly
no outgoing calls
no test coverage detected