init build files
Browse files
README.md
CHANGED
|
@@ -1,3 +1,5 @@
|
|
| 1 |
---
|
| 2 |
license: apache-2.0
|
| 3 |
---
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
license: apache-2.0
|
| 3 |
---
|
| 4 |
+
|
| 5 |
+
# npu-swiglu
|
build/torch26-torch_npu26-cann-aarch64-linux/SwiGlu/__init__.py
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import torch
|
| 2 |
+
import torch_npu
|
| 3 |
+
from . import layers
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
__all__ = [
|
| 7 |
+
"layers",
|
| 8 |
+
]
|
build/torch26-torch_npu26-cann-aarch64-linux/SwiGlu/layers.py
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import torch
|
| 2 |
+
import torch_npu
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
class SwiGlu(torch.nn.Module):
|
| 6 |
+
def forward(self, x):
|
| 7 |
+
"""
|
| 8 |
+
Forward pass through the SwiGlu.
|
| 9 |
+
Args:
|
| 10 |
+
x (torch.Tensor): The input tensor.
|
| 11 |
+
Returns:
|
| 12 |
+
torch.Tensor: The output tensor after applying SwiGlu.
|
| 13 |
+
"""
|
| 14 |
+
return torch_npu.npu_swiglu(x)
|
build/torch27-torch_npu27-cann-aarch64-linux/SwiGlu/__init__.py
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import torch
|
| 2 |
+
import torch_npu
|
| 3 |
+
from . import layers
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
__all__ = [
|
| 7 |
+
"layers",
|
| 8 |
+
]
|
build/torch27-torch_npu27-cann-aarch64-linux/SwiGlu/layers.py
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import torch
|
| 2 |
+
import torch_npu
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
class SwiGlu(torch.nn.Module):
|
| 6 |
+
def forward(self, x):
|
| 7 |
+
"""
|
| 8 |
+
Forward pass through the SwiGlu.
|
| 9 |
+
Args:
|
| 10 |
+
x (torch.Tensor): The input tensor.
|
| 11 |
+
Returns:
|
| 12 |
+
torch.Tensor: The output tensor after applying SwiGlu.
|
| 13 |
+
"""
|
| 14 |
+
return torch_npu.npu_swiglu(x)
|