| 43 | |
| 44 | class STNkd(nn.Module): |
| 45 | def __init__(self, k=64): |
| 46 | super(STNkd, self).__init__() |
| 47 | self.conv1 = torch.nn.Conv1d(k, 64, 1) |
| 48 | self.conv2 = torch.nn.Conv1d(64, 128, 1) |
| 49 | self.conv3 = torch.nn.Conv1d(128, 1024, 1) |
| 50 | self.fc1 = nn.Linear(1024, 512) |
| 51 | self.fc2 = nn.Linear(512, 256) |
| 52 | self.fc3 = nn.Linear(256, k * k) |
| 53 | self.relu = nn.ReLU() |
| 54 | |
| 55 | self.bn1 = nn.BatchNorm1d(64) |
| 56 | self.bn2 = nn.BatchNorm1d(128) |
| 57 | self.bn3 = nn.BatchNorm1d(1024) |
| 58 | self.bn4 = nn.BatchNorm1d(512) |
| 59 | self.bn5 = nn.BatchNorm1d(256) |
| 60 | |
| 61 | self.k = k |
| 62 | |
| 63 | def forward(self, x): |
| 64 | batchsize = x.size()[0] |