(self, feature_sizes=[32, 16, 8, 4],
num_channels=[64, 128, 256, 512], interm_dim=128)
| 9 | # https://github.com/Mephisto405/Learning-Loss-for-Active-Learning |
| 10 | class LossNet(nn.Module): |
| 11 | def __init__(self, feature_sizes=[32, 16, 8, 4], |
| 12 | num_channels=[64, 128, 256, 512], interm_dim=128): |
| 13 | super(LossNet, self).__init__() |
| 14 | |
| 15 | self.GAP1 = nn.AvgPool2d(feature_sizes[0]) |
| 16 | self.GAP2 = nn.AvgPool2d(feature_sizes[1]) |
| 17 | self.GAP3 = nn.AvgPool2d(feature_sizes[2]) |
| 18 | self.GAP4 = nn.AvgPool2d(feature_sizes[3]) |
| 19 | |
| 20 | self.FC1 = nn.Linear(num_channels[0], interm_dim) |
| 21 | self.FC2 = nn.Linear(num_channels[1], interm_dim) |
| 22 | self.FC3 = nn.Linear(num_channels[2], interm_dim) |
| 23 | self.FC4 = nn.Linear(num_channels[3], interm_dim) |
| 24 | |
| 25 | self.linear = nn.Linear(4 * interm_dim, 1) |
| 26 | |
| 27 | def forward(self, features,intermediate=False): |
| 28 | out1 = self.GAP1(features[0]) |
nothing calls this directly
no outgoing calls
no test coverage detected