mirror of
https://github.com/labmlai/annotated_deep_learning_paper_implementations.git
synced 2025-08-15 18:27:20 +08:00
13 lines
240 B
Python
13 lines
240 B
Python
import torch
|
|
from torch import nn
|
|
|
|
|
|
|
|
class Swish(nn.Module):
|
|
def __init__(self):
|
|
super().__init__()
|
|
self.sigmoid = nn.Sigmoid()
|
|
|
|
def forward(self, x: torch.Tensor) -> torch.Tensor:
|
|
return x * self.sigmoid(x)
|