Spaces:
Sleeping
Sleeping
| import os.path as osp | |
| import torch | |
| import torch.nn as nn | |
| from torch.nn import functional as F | |
| class Adapter(nn.Module): | |
| def __init__(self, c_in, reduction=4): | |
| super(Adapter, self).__init__() | |
| self.fc = nn.Sequential( | |
| nn.Linear(c_in, c_in // reduction, bias=False), | |
| nn.ReLU(inplace=True), | |
| nn.Linear(c_in // reduction, c_in, bias=False), | |
| nn.ReLU(inplace=True) | |
| ) | |
| def forward(self, x): | |
| x = self.fc(x) | |
| return x |