提交 71209a60 authored 作者: Glenn Jocher's avatar Glenn Jocher

exportable Hardswish() implementation

上级 fd71fe84
......@@ -10,6 +10,13 @@ class Swish(nn.Module): #
return x * torch.sigmoid(x)
class Hardswish(nn.Module): # alternative to nn.Hardswish() for export
@staticmethod
def forward(x):
# return x * F.hardsigmoid(x)
return x * F.hardtanh(x + 3, 0., 6.) / 6.
class MemoryEfficientSwish(nn.Module):
class F(torch.autograd.Function):
@staticmethod
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论