mmcv/mmcv/cnn/bricks/swish.py
Jerry Jiarui XU c47c9196d0
[Docs] Add header for files (#1181)
* [Docs] Add header for files

* change to OpenMMLab

* add headers for .cpp, .cu, .h, .cuh

* replace Open-MMLab with OpenMMLab
2021-08-08 22:10:55 +08:00

26 lines
485 B
Python

# Copyright (c) OpenMMLab. All rights reserved.
import torch
import torch.nn as nn
from .registry import ACTIVATION_LAYERS
@ACTIVATION_LAYERS.register_module()
class Swish(nn.Module):
"""Swish Module.
This module applies the swish function:
.. math::
Swish(x) = x * Sigmoid(x)
Returns:
Tensor: The output tensor.
"""
def __init__(self):
super(Swish, self).__init__()
def forward(self, x):
return x * torch.sigmoid(x)