Spaces:
Sleeping
Sleeping
File size: 503 Bytes
f2f112a |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
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 |