| import torch | |
| import torch.nn as nn | |
| import torch.nn.functional as F | |
| class SiluAndMul(nn.Module): | |
| def __init__(self): | |
| super().__init__() | |
| def forward(self, x: torch.Tensor) -> torch.Tensor: | |
| x, y = x.chunk(2, -1) | |
| return F.silu(x) * y | |
| import torch | |
| import torch.nn as nn | |
| import torch.nn.functional as F | |
| class SiluAndMul(nn.Module): | |
| def __init__(self): | |
| super().__init__() | |
| def forward(self, x: torch.Tensor) -> torch.Tensor: | |
| x, y = x.chunk(2, -1) | |
| return F.silu(x) * y | |