[Kernel][CPU] Add Quick gelu to CPU (#5717)

This commit is contained in:
Roger Wang
2024-06-21 06:39:40 +00:00
committed by GitHub
parent d9a252bc8e
commit bd620b01fb
4 changed files with 29 additions and 0 deletions
+3
View File
@@ -43,6 +43,9 @@ class ipex_ops:
def gelu_new(out: torch.Tensor, x: torch.Tensor) -> None:
out.copy_(torch.nn.functional.gelu(x))
# TODO add implementation of gelu_quick here
# def gelu_quick(out: torch.Tensor, x: torch.Tensor) -> None:
def paged_attention_v1(
out: torch.Tensor,
query: torch.Tensor,
+3
View File
@@ -155,6 +155,9 @@ class QuickGELU(CustomOp):
ops.gelu_quick(out, x)
return out
# TODO implement forward_xpu for QuickGELU
# def forward_xpu(self, x: torch.Tensor) -> torch.Tensor:
class ScaledActivation(nn.Module):
"""An activation function with post-scale parameters.