This commit is contained in:
Glenn Jocher 2019-11-12 17:57:22 -08:00
parent e66323e893
commit 444a9f7099
1 changed files with 9 additions and 0 deletions

View File

@ -120,6 +120,15 @@ class Swish(nn.Module):
return x * torch.sigmoid(x)
class Mish(nn.Module): # https://github.com/digantamisra98/Mish
# Applies the mish function element-wise: mish(x) = x * tanh(softplus(x)) = x * tanh(ln(1 + exp(x)))
def __init__(self):
super().__init__()
def forward(self, x):
return x * torch.tanh(F.softplus(x))
class YOLOLayer(nn.Module):
def __init__(self, anchors, nc, img_size, yolo_index, arc):
super(YOLOLayer, self).__init__()