A single linear layer which does a 1x1 conv
| 66 | |
| 67 | |
| 68 | class NetLinLayer(nn.Module): |
| 69 | """A single linear layer which does a 1x1 conv""" |
| 70 | |
| 71 | def __init__(self, chn_in, chn_out=1, use_dropout=False): |
| 72 | super(NetLinLayer, self).__init__() |
| 73 | layers = ( |
| 74 | [ |
| 75 | nn.Dropout(), |
| 76 | ] |
| 77 | if (use_dropout) |
| 78 | else [] |
| 79 | ) |
| 80 | layers += [ |
| 81 | nn.Conv2d(chn_in, chn_out, 1, stride=1, padding=0, bias=False), |
| 82 | ] |
| 83 | self.model = nn.Sequential(*layers) |
| 84 | |
| 85 | |
| 86 | class vgg16(torch.nn.Module): |