Ouzhang's picture
Add files using upload-large-folder tool
31dc8dc verified
Raw
History Blame Contribute Delete
360 Bytes
import torch
from torch import nn
import torch.nn.functional as F
from liger_kernel.ops.swiglu import LigerSiLUMulFunction
class SiluAndMul(nn.Module):
def __init__(self):
super().__init__()
@torch.compile
def forward(self, x: torch.Tensor) -> torch.Tensor:
x, y = x.chunk(2, -1)
return LigerSiLUMulFunction.apply(x, y)