Kernels
danieldk HF Staff commited on
Commit
b5e77b3
·
verified ·
1 Parent(s): 5098089

Build uploaded using `kernels`.

Browse files
.gitattributes CHANGED
@@ -347,3 +347,4 @@ build/torch211-cxx11-rocm71-x86_64-linux/_relu_rocm_918d6dc.abi3.so filter=lfs d
347
  build/torch211-cxx11-rocm72-x86_64-linux/_relu_rocm_918d6dc.abi3.so filter=lfs diff=lfs merge=lfs -text
348
  build/torch211-cxx11-xpu20253-x86_64-linux/_relu_xpu_918d6dc.abi3.so filter=lfs diff=lfs merge=lfs -text
349
  build/torch29-cxx11-cu129-x86_64-linux/_relu_cuda_918d6dc.abi3.so filter=lfs diff=lfs merge=lfs -text
 
 
347
  build/torch211-cxx11-rocm72-x86_64-linux/_relu_rocm_918d6dc.abi3.so filter=lfs diff=lfs merge=lfs -text
348
  build/torch211-cxx11-xpu20253-x86_64-linux/_relu_xpu_918d6dc.abi3.so filter=lfs diff=lfs merge=lfs -text
349
  build/torch29-cxx11-cu129-x86_64-linux/_relu_cuda_918d6dc.abi3.so filter=lfs diff=lfs merge=lfs -text
350
+ build/torch211-cu128-x86_64-windows/_relu_cuda_e08ad6f.pyd filter=lfs diff=lfs merge=lfs -text
build/torch211-cu128-x86_64-windows/__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-cu128-x86_64-windows/_ops.py ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ import torch
2
+ from . import _relu_cuda_e08ad6f
3
+ ops = torch.ops._relu_cuda_e08ad6f
4
+
5
+ def add_op_namespace_prefix(op_name: str):
6
+ """
7
+ Prefix op by namespace.
8
+ """
9
+ return f"_relu_cuda_e08ad6f::{op_name}"
build/torch211-cu128-x86_64-windows/_relu_cuda_e08ad6f.pyd ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d0026652617bd14aa36f5dc3e6f970653006605ff14071af8874648f9ba8386b
3
+ size 203776
build/torch211-cu128-x86_64-windows/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-cu128-x86_64-windows/metadata.json ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "version": 1,
3
+ "license": "Apache-2.0",
4
+ "python-depends": [],
5
+ "backend": {
6
+ "type": "cuda",
7
+ "archs": [
8
+ "10.0",
9
+ "10.1",
10
+ "12.0+PTX",
11
+ "7.0",
12
+ "7.2",
13
+ "7.5",
14
+ "8.0",
15
+ "8.6",
16
+ "8.7",
17
+ "8.9",
18
+ "9.0"
19
+ ]
20
+ }
21
+ }
build/torch211-cu128-x86_64-windows/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")))