Kernels
kernels-bot commited on
Commit
1077ae4
·
verified ·
1 Parent(s): 3312f2f

Uploaded using `kernel-builder`.

Browse files
.gitattributes CHANGED
@@ -362,3 +362,5 @@ build/torch211-cu128-x86_64-windows/_relu_cuda_f560032.pyd filter=lfs diff=lfs m
362
  build/torch210-xpu20253-x86_64-windows/_relu_xpu_f560032.pyd filter=lfs diff=lfs merge=lfs -text
363
  build/torch211-cu128-x86_64-windows/_relu_cuda_e46713e.pyd filter=lfs diff=lfs merge=lfs -text
364
  build/torch210-xpu20253-x86_64-windows/_relu_xpu_e46713e.pyd filter=lfs diff=lfs merge=lfs -text
 
 
 
362
  build/torch210-xpu20253-x86_64-windows/_relu_xpu_f560032.pyd filter=lfs diff=lfs merge=lfs -text
363
  build/torch211-cu128-x86_64-windows/_relu_cuda_e46713e.pyd filter=lfs diff=lfs merge=lfs -text
364
  build/torch210-xpu20253-x86_64-windows/_relu_xpu_e46713e.pyd filter=lfs diff=lfs merge=lfs -text
365
+ build/torch210-metal-aarch64-darwin/_relu_metal_a99dbbb.abi3.so filter=lfs diff=lfs merge=lfs -text
366
+ build/torch211-metal-aarch64-darwin/_relu_metal_a99dbbb.abi3.so filter=lfs diff=lfs merge=lfs -text
build/torch210-cpu-aarch64-darwin/_ops.py CHANGED
@@ -1,9 +1,9 @@
1
  import torch
2
- from . import _relu_cpu_6261c06
3
- ops = torch.ops._relu_cpu_6261c06
4
 
5
  def add_op_namespace_prefix(op_name: str):
6
  """
7
  Prefix op by namespace.
8
  """
9
- return f"_relu_cpu_6261c06::{op_name}"
 
1
  import torch
2
+ from . import _relu_cpu_a99dbbb
3
+ ops = torch.ops._relu_cpu_a99dbbb
4
 
5
  def add_op_namespace_prefix(op_name: str):
6
  """
7
  Prefix op by namespace.
8
  """
9
+ return f"_relu_cpu_a99dbbb::{op_name}"
build/torch210-cpu-aarch64-darwin/{_relu_cpu_6261c06.abi3.so → _relu_cpu_a99dbbb.abi3.so} RENAMED
Binary files a/build/torch210-cpu-aarch64-darwin/_relu_cpu_6261c06.abi3.so and b/build/torch210-cpu-aarch64-darwin/_relu_cpu_a99dbbb.abi3.so differ
 
build/torch210-cpu-aarch64-darwin/metadata.json CHANGED
@@ -1,5 +1,8 @@
1
  {
2
  "version": 1,
3
  "license": "Apache-2.0",
4
- "python-depends": []
 
 
 
5
  }
 
1
  {
2
  "version": 1,
3
  "license": "Apache-2.0",
4
+ "python-depends": [],
5
+ "backend": {
6
+ "type": "cpu"
7
+ }
8
  }
build/torch210-cpu-aarch64-darwin/relu/__init__.py CHANGED
@@ -1,10 +1,10 @@
1
  import ctypes
 
2
  import sys
3
-
4
- import importlib
5
  from pathlib import Path
6
  from types import ModuleType
7
 
 
8
  def _import_from_path(file_path: Path) -> ModuleType:
9
  # We cannot use the module name as-is, after adding it to `sys.modules`,
10
  # it would also be used for other imports. So, we make a module name that
 
1
  import ctypes
2
+ import importlib.util
3
  import sys
 
 
4
  from pathlib import Path
5
  from types import ModuleType
6
 
7
+
8
  def _import_from_path(file_path: Path) -> ModuleType:
9
  # We cannot use the module name as-is, after adding it to `sys.modules`,
10
  # it would also be used for other imports. So, we make a module name that
build/torch210-metal-aarch64-darwin/_ops.py CHANGED
@@ -1,9 +1,9 @@
1
  import torch
2
- from . import _relu_metal_6261c06
3
- ops = torch.ops._relu_metal_6261c06
4
 
5
  def add_op_namespace_prefix(op_name: str):
6
  """
7
  Prefix op by namespace.
8
  """
9
- return f"_relu_metal_6261c06::{op_name}"
 
1
  import torch
2
+ from . import _relu_metal_a99dbbb
3
+ ops = torch.ops._relu_metal_a99dbbb
4
 
5
  def add_op_namespace_prefix(op_name: str):
6
  """
7
  Prefix op by namespace.
8
  """
9
+ return f"_relu_metal_a99dbbb::{op_name}"
build/torch210-metal-aarch64-darwin/{_relu_metal_6261c06.abi3.so → _relu_metal_a99dbbb.abi3.so} RENAMED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:8dfb5099b945261311ae3e457b78b0acd63463c84f73246c2492d19698cfaaae
3
- size 100680
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:48ad903b6d767d68b32bad56cdae3f7e845e211680c3c49d5aafc12b4f604f70
3
+ size 100920
build/torch210-metal-aarch64-darwin/metadata.json CHANGED
@@ -1,5 +1,8 @@
1
  {
2
  "version": 1,
3
  "license": "Apache-2.0",
4
- "python-depends": []
 
 
 
5
  }
 
1
  {
2
  "version": 1,
3
  "license": "Apache-2.0",
4
+ "python-depends": [],
5
+ "backend": {
6
+ "type": "metal"
7
+ }
8
  }
build/torch210-metal-aarch64-darwin/relu/__init__.py CHANGED
@@ -1,10 +1,10 @@
1
  import ctypes
 
2
  import sys
3
-
4
- import importlib
5
  from pathlib import Path
6
  from types import ModuleType
7
 
 
8
  def _import_from_path(file_path: Path) -> ModuleType:
9
  # We cannot use the module name as-is, after adding it to `sys.modules`,
10
  # it would also be used for other imports. So, we make a module name that
 
1
  import ctypes
2
+ import importlib.util
3
  import sys
 
 
4
  from pathlib import Path
5
  from types import ModuleType
6
 
7
+
8
  def _import_from_path(file_path: Path) -> ModuleType:
9
  # We cannot use the module name as-is, after adding it to `sys.modules`,
10
  # it would also be used for other imports. So, we make a module name that
build/torch211-cpu-aarch64-darwin/__init__.py ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import Optional
2
+
3
+ import torch
4
+
5
+ from ._ops import ops
6
+
7
+ from . import layers
8
+
9
+
10
+ def relu(x: torch.Tensor, out: Optional[torch.Tensor] = None) -> torch.Tensor:
11
+ if out is None:
12
+ out = torch.empty_like(x)
13
+ ops.relu(out, x)
14
+ return out
15
+
16
+ __all__ = ["relu", "layers"]
build/torch211-cpu-aarch64-darwin/_ops.py ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ import torch
2
+ from . import _relu_cpu_a99dbbb
3
+ ops = torch.ops._relu_cpu_a99dbbb
4
+
5
+ def add_op_namespace_prefix(op_name: str):
6
+ """
7
+ Prefix op by namespace.
8
+ """
9
+ return f"_relu_cpu_a99dbbb::{op_name}"
build/torch211-cpu-aarch64-darwin/_relu_cpu_a99dbbb.abi3.so ADDED
Binary file (80.2 kB). View file
 
build/torch211-cpu-aarch64-darwin/layers/__init__.py ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import torch
2
+ import torch.nn as nn
3
+
4
+ from .._ops import ops
5
+
6
+
7
+ class ReLU(nn.Module):
8
+ def forward(self, x: torch.Tensor) -> torch.Tensor:
9
+ out = torch.empty_like(x)
10
+ ops.relu(out, x)
11
+ return out
build/torch211-cpu-aarch64-darwin/metadata.json ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "version": 1,
3
+ "license": "Apache-2.0",
4
+ "python-depends": [],
5
+ "backend": {
6
+ "type": "cpu"
7
+ }
8
+ }
build/torch211-cpu-aarch64-darwin/relu/__init__.py ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import ctypes
2
+ import importlib.util
3
+ import sys
4
+ from pathlib import Path
5
+ from types import ModuleType
6
+
7
+
8
+ def _import_from_path(file_path: Path) -> ModuleType:
9
+ # We cannot use the module name as-is, after adding it to `sys.modules`,
10
+ # it would also be used for other imports. So, we make a module name that
11
+ # depends on the path for it to be unique using the hex-encoded hash of
12
+ # the path.
13
+ path_hash = "{:x}".format(ctypes.c_size_t(hash(file_path.absolute())).value)
14
+ module_name = path_hash
15
+ spec = importlib.util.spec_from_file_location(module_name, file_path)
16
+ if spec is None:
17
+ raise ImportError(f"Cannot load spec for {module_name} from {file_path}")
18
+ module = importlib.util.module_from_spec(spec)
19
+ if module is None:
20
+ raise ImportError(f"Cannot load module {module_name} from spec")
21
+ sys.modules[module_name] = module
22
+ spec.loader.exec_module(module) # type: ignore
23
+ return module
24
+
25
+
26
+ globals().update(vars(_import_from_path(Path(__file__).parent.parent / "__init__.py")))
build/torch211-metal-aarch64-darwin/__init__.py ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import Optional
2
+
3
+ import torch
4
+
5
+ from ._ops import ops
6
+
7
+ from . import layers
8
+
9
+
10
+ def relu(x: torch.Tensor, out: Optional[torch.Tensor] = None) -> torch.Tensor:
11
+ if out is None:
12
+ out = torch.empty_like(x)
13
+ ops.relu(out, x)
14
+ return out
15
+
16
+ __all__ = ["relu", "layers"]
build/torch211-metal-aarch64-darwin/_ops.py ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ import torch
2
+ from . import _relu_metal_a99dbbb
3
+ ops = torch.ops._relu_metal_a99dbbb
4
+
5
+ def add_op_namespace_prefix(op_name: str):
6
+ """
7
+ Prefix op by namespace.
8
+ """
9
+ return f"_relu_metal_a99dbbb::{op_name}"
build/torch211-metal-aarch64-darwin/_relu_metal_a99dbbb.abi3.so ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a50fc4ae8185050cfacb50657bfb0a83c0efd188dd800dd02ce804f7f5be66d7
3
+ size 100920
build/torch211-metal-aarch64-darwin/layers/__init__.py ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import torch
2
+ import torch.nn as nn
3
+
4
+ from .._ops import ops
5
+
6
+
7
+ class ReLU(nn.Module):
8
+ def forward(self, x: torch.Tensor) -> torch.Tensor:
9
+ out = torch.empty_like(x)
10
+ ops.relu(out, x)
11
+ return out
build/torch211-metal-aarch64-darwin/metadata.json ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "version": 1,
3
+ "license": "Apache-2.0",
4
+ "python-depends": [],
5
+ "backend": {
6
+ "type": "metal"
7
+ }
8
+ }
build/torch211-metal-aarch64-darwin/relu/__init__.py ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import ctypes
2
+ import importlib.util
3
+ import sys
4
+ from pathlib import Path
5
+ from types import ModuleType
6
+
7
+
8
+ def _import_from_path(file_path: Path) -> ModuleType:
9
+ # We cannot use the module name as-is, after adding it to `sys.modules`,
10
+ # it would also be used for other imports. So, we make a module name that
11
+ # depends on the path for it to be unique using the hex-encoded hash of
12
+ # the path.
13
+ path_hash = "{:x}".format(ctypes.c_size_t(hash(file_path.absolute())).value)
14
+ module_name = path_hash
15
+ spec = importlib.util.spec_from_file_location(module_name, file_path)
16
+ if spec is None:
17
+ raise ImportError(f"Cannot load spec for {module_name} from {file_path}")
18
+ module = importlib.util.module_from_spec(spec)
19
+ if module is None:
20
+ raise ImportError(f"Cannot load module {module_name} from spec")
21
+ sys.modules[module_name] = module
22
+ spec.loader.exec_module(module) # type: ignore
23
+ return module
24
+
25
+
26
+ globals().update(vars(_import_from_path(Path(__file__).parent.parent / "__init__.py")))