Kernels
kernels-bot commited on
Commit
f8b9118
·
verified ·
1 Parent(s): 03f3c79

Uploaded using `kernel-builder`.

Browse files
Files changed (36) hide show
  1. build/torch210-cxx11-cu126-aarch64-linux/{_deformable_detr_cuda_86f75d9.abi3.so → _deformable_detr_cuda_c35b54a.abi3.so} +1 -1
  2. build/torch210-cxx11-cu126-aarch64-linux/_ops.py +3 -3
  3. build/torch210-cxx11-cu126-aarch64-linux/metadata.json +1 -1
  4. build/torch210-cxx11-cu128-aarch64-linux/{_deformable_detr_cuda_86f75d9.abi3.so → _deformable_detr_cuda_c35b54a.abi3.so} +1 -1
  5. build/torch210-cxx11-cu128-aarch64-linux/_ops.py +3 -3
  6. build/torch210-cxx11-cu128-aarch64-linux/metadata.json +1 -1
  7. build/torch210-cxx11-cu130-aarch64-linux/{_deformable_detr_cuda_86f75d9.abi3.so → _deformable_detr_cuda_c35b54a.abi3.so} +1 -1
  8. build/torch210-cxx11-cu130-aarch64-linux/_ops.py +3 -3
  9. build/torch210-cxx11-cu130-aarch64-linux/metadata.json +1 -1
  10. build/torch211-cxx11-cu126-aarch64-linux/{_deformable_detr_cuda_86f75d9.abi3.so → _deformable_detr_cuda_c35b54a.abi3.so} +1 -1
  11. build/torch211-cxx11-cu126-aarch64-linux/_ops.py +3 -3
  12. build/torch211-cxx11-cu126-aarch64-linux/metadata.json +1 -1
  13. build/torch211-cxx11-cu128-aarch64-linux/{_deformable_detr_cuda_86f75d9.abi3.so → _deformable_detr_cuda_c35b54a.abi3.so} +1 -1
  14. build/torch211-cxx11-cu128-aarch64-linux/_ops.py +3 -3
  15. build/torch211-cxx11-cu128-aarch64-linux/metadata.json +1 -1
  16. build/torch211-cxx11-cu130-aarch64-linux/{_deformable_detr_cuda_86f75d9.abi3.so → _deformable_detr_cuda_c35b54a.abi3.so} +1 -1
  17. build/torch211-cxx11-cu130-aarch64-linux/_ops.py +3 -3
  18. build/torch211-cxx11-cu130-aarch64-linux/metadata.json +1 -1
  19. build/torch212-cxx11-cu126-aarch64-linux/__init__.py +46 -0
  20. build/torch212-cxx11-cu126-aarch64-linux/_deformable_detr_cuda_c35b54a.abi3.so +3 -0
  21. build/torch212-cxx11-cu126-aarch64-linux/_ops.py +9 -0
  22. build/torch212-cxx11-cu126-aarch64-linux/deformable_detr/__init__.py +26 -0
  23. build/torch212-cxx11-cu126-aarch64-linux/layers.py +84 -0
  24. build/torch212-cxx11-cu126-aarch64-linux/metadata.json +20 -0
  25. build/torch212-cxx11-cu130-aarch64-linux/__init__.py +46 -0
  26. build/torch212-cxx11-cu130-aarch64-linux/_deformable_detr_cuda_c35b54a.abi3.so +3 -0
  27. build/torch212-cxx11-cu130-aarch64-linux/_ops.py +9 -0
  28. build/torch212-cxx11-cu130-aarch64-linux/deformable_detr/__init__.py +26 -0
  29. build/torch212-cxx11-cu130-aarch64-linux/layers.py +84 -0
  30. build/torch212-cxx11-cu130-aarch64-linux/metadata.json +21 -0
  31. build/torch212-cxx11-cu132-aarch64-linux/__init__.py +46 -0
  32. build/torch212-cxx11-cu132-aarch64-linux/_deformable_detr_cuda_c35b54a.abi3.so +3 -0
  33. build/torch212-cxx11-cu132-aarch64-linux/_ops.py +9 -0
  34. build/torch212-cxx11-cu132-aarch64-linux/deformable_detr/__init__.py +26 -0
  35. build/torch212-cxx11-cu132-aarch64-linux/layers.py +84 -0
  36. build/torch212-cxx11-cu132-aarch64-linux/metadata.json +21 -0
build/torch210-cxx11-cu126-aarch64-linux/{_deformable_detr_cuda_86f75d9.abi3.so → _deformable_detr_cuda_c35b54a.abi3.so} RENAMED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:8f83d7eac250567d574bca8b45b0df27ce6aeea3a50ddcba333b8ff143503d97
3
  size 8606368
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a78e7fffe93acd3db377ab1850aa4927885a1ddc9ed699cd7a8044fd28e3803b
3
  size 8606368
build/torch210-cxx11-cu126-aarch64-linux/_ops.py CHANGED
@@ -1,9 +1,9 @@
1
  import torch
2
- from . import _deformable_detr_cuda_86f75d9
3
- ops = torch.ops._deformable_detr_cuda_86f75d9
4
 
5
  def add_op_namespace_prefix(op_name: str):
6
  """
7
  Prefix op by namespace.
8
  """
9
- return f"_deformable_detr_cuda_86f75d9::{op_name}"
 
1
  import torch
2
+ from . import _deformable_detr_cuda_c35b54a
3
+ ops = torch.ops._deformable_detr_cuda_c35b54a
4
 
5
  def add_op_namespace_prefix(op_name: str):
6
  """
7
  Prefix op by namespace.
8
  """
9
+ return f"_deformable_detr_cuda_c35b54a::{op_name}"
build/torch210-cxx11-cu126-aarch64-linux/metadata.json CHANGED
@@ -1,6 +1,6 @@
1
  {
2
  "name": "deformable-detr",
3
- "id": "_deformable_detr_cuda_86f75d9",
4
  "version": 1,
5
  "license": "Apache-2.0",
6
  "python-depends": [],
 
1
  {
2
  "name": "deformable-detr",
3
+ "id": "_deformable_detr_cuda_c35b54a",
4
  "version": 1,
5
  "license": "Apache-2.0",
6
  "python-depends": [],
build/torch210-cxx11-cu128-aarch64-linux/{_deformable_detr_cuda_86f75d9.abi3.so → _deformable_detr_cuda_c35b54a.abi3.so} RENAMED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:e245677fedf207341fd149c5a2b1af4a3417da8f26a1b59f78f4fb5a16cbbc32
3
  size 11621120
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ba51c83bd4d18c329f5f48d279d5a4983fb66c79eb67e1408741a8d965ac4137
3
  size 11621120
build/torch210-cxx11-cu128-aarch64-linux/_ops.py CHANGED
@@ -1,9 +1,9 @@
1
  import torch
2
- from . import _deformable_detr_cuda_86f75d9
3
- ops = torch.ops._deformable_detr_cuda_86f75d9
4
 
5
  def add_op_namespace_prefix(op_name: str):
6
  """
7
  Prefix op by namespace.
8
  """
9
- return f"_deformable_detr_cuda_86f75d9::{op_name}"
 
1
  import torch
2
+ from . import _deformable_detr_cuda_c35b54a
3
+ ops = torch.ops._deformable_detr_cuda_c35b54a
4
 
5
  def add_op_namespace_prefix(op_name: str):
6
  """
7
  Prefix op by namespace.
8
  """
9
+ return f"_deformable_detr_cuda_c35b54a::{op_name}"
build/torch210-cxx11-cu128-aarch64-linux/metadata.json CHANGED
@@ -1,6 +1,6 @@
1
  {
2
  "name": "deformable-detr",
3
- "id": "_deformable_detr_cuda_86f75d9",
4
  "version": 1,
5
  "license": "Apache-2.0",
6
  "python-depends": [],
 
1
  {
2
  "name": "deformable-detr",
3
+ "id": "_deformable_detr_cuda_c35b54a",
4
  "version": 1,
5
  "license": "Apache-2.0",
6
  "python-depends": [],
build/torch210-cxx11-cu130-aarch64-linux/{_deformable_detr_cuda_86f75d9.abi3.so → _deformable_detr_cuda_c35b54a.abi3.so} RENAMED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:4090b9a5be5fd27aabb5ecef49550a543f72c3221973e78cc0e918a2f057716a
3
  size 9825896
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b0ddf3c6c7c6cb973af5af6b7be05b513a336abf969fdd9441c60c82ce0c1258
3
  size 9825896
build/torch210-cxx11-cu130-aarch64-linux/_ops.py CHANGED
@@ -1,9 +1,9 @@
1
  import torch
2
- from . import _deformable_detr_cuda_86f75d9
3
- ops = torch.ops._deformable_detr_cuda_86f75d9
4
 
5
  def add_op_namespace_prefix(op_name: str):
6
  """
7
  Prefix op by namespace.
8
  """
9
- return f"_deformable_detr_cuda_86f75d9::{op_name}"
 
1
  import torch
2
+ from . import _deformable_detr_cuda_c35b54a
3
+ ops = torch.ops._deformable_detr_cuda_c35b54a
4
 
5
  def add_op_namespace_prefix(op_name: str):
6
  """
7
  Prefix op by namespace.
8
  """
9
+ return f"_deformable_detr_cuda_c35b54a::{op_name}"
build/torch210-cxx11-cu130-aarch64-linux/metadata.json CHANGED
@@ -1,6 +1,6 @@
1
  {
2
  "name": "deformable-detr",
3
- "id": "_deformable_detr_cuda_86f75d9",
4
  "version": 1,
5
  "license": "Apache-2.0",
6
  "python-depends": [],
 
1
  {
2
  "name": "deformable-detr",
3
+ "id": "_deformable_detr_cuda_c35b54a",
4
  "version": 1,
5
  "license": "Apache-2.0",
6
  "python-depends": [],
build/torch211-cxx11-cu126-aarch64-linux/{_deformable_detr_cuda_86f75d9.abi3.so → _deformable_detr_cuda_c35b54a.abi3.so} RENAMED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:ab0eba678eee353ed44a90fc18ec09eba18d3d8420f274b9ccff36a5ef561f5c
3
  size 8606480
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:34d9d5e50c94aaa7d47f2aae8cf4f893d92dc24215ebbcba7c2d3ade54209bd2
3
  size 8606480
build/torch211-cxx11-cu126-aarch64-linux/_ops.py CHANGED
@@ -1,9 +1,9 @@
1
  import torch
2
- from . import _deformable_detr_cuda_86f75d9
3
- ops = torch.ops._deformable_detr_cuda_86f75d9
4
 
5
  def add_op_namespace_prefix(op_name: str):
6
  """
7
  Prefix op by namespace.
8
  """
9
- return f"_deformable_detr_cuda_86f75d9::{op_name}"
 
1
  import torch
2
+ from . import _deformable_detr_cuda_c35b54a
3
+ ops = torch.ops._deformable_detr_cuda_c35b54a
4
 
5
  def add_op_namespace_prefix(op_name: str):
6
  """
7
  Prefix op by namespace.
8
  """
9
+ return f"_deformable_detr_cuda_c35b54a::{op_name}"
build/torch211-cxx11-cu126-aarch64-linux/metadata.json CHANGED
@@ -1,6 +1,6 @@
1
  {
2
  "name": "deformable-detr",
3
- "id": "_deformable_detr_cuda_86f75d9",
4
  "version": 1,
5
  "license": "Apache-2.0",
6
  "python-depends": [],
 
1
  {
2
  "name": "deformable-detr",
3
+ "id": "_deformable_detr_cuda_c35b54a",
4
  "version": 1,
5
  "license": "Apache-2.0",
6
  "python-depends": [],
build/torch211-cxx11-cu128-aarch64-linux/{_deformable_detr_cuda_86f75d9.abi3.so → _deformable_detr_cuda_c35b54a.abi3.so} RENAMED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:21f63f40573eb787e89fc886341e9028be0ed8b0b6c44a5e2bc8439f541cae20
3
  size 11621232
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fac9605c94a04d948e421567004b5ec92485bec3410dde06e19a9f86309f6648
3
  size 11621232
build/torch211-cxx11-cu128-aarch64-linux/_ops.py CHANGED
@@ -1,9 +1,9 @@
1
  import torch
2
- from . import _deformable_detr_cuda_86f75d9
3
- ops = torch.ops._deformable_detr_cuda_86f75d9
4
 
5
  def add_op_namespace_prefix(op_name: str):
6
  """
7
  Prefix op by namespace.
8
  """
9
- return f"_deformable_detr_cuda_86f75d9::{op_name}"
 
1
  import torch
2
+ from . import _deformable_detr_cuda_c35b54a
3
+ ops = torch.ops._deformable_detr_cuda_c35b54a
4
 
5
  def add_op_namespace_prefix(op_name: str):
6
  """
7
  Prefix op by namespace.
8
  """
9
+ return f"_deformable_detr_cuda_c35b54a::{op_name}"
build/torch211-cxx11-cu128-aarch64-linux/metadata.json CHANGED
@@ -1,6 +1,6 @@
1
  {
2
  "name": "deformable-detr",
3
- "id": "_deformable_detr_cuda_86f75d9",
4
  "version": 1,
5
  "license": "Apache-2.0",
6
  "python-depends": [],
 
1
  {
2
  "name": "deformable-detr",
3
+ "id": "_deformable_detr_cuda_c35b54a",
4
  "version": 1,
5
  "license": "Apache-2.0",
6
  "python-depends": [],
build/torch211-cxx11-cu130-aarch64-linux/{_deformable_detr_cuda_86f75d9.abi3.so → _deformable_detr_cuda_c35b54a.abi3.so} RENAMED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:5404a3384eb16c51370320aff1795107eca9afa9b63a3a436c7b254facd42ddb
3
  size 9891552
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:56a6ec91cabb15aa60ec67fe35ddcf28f753ad31f40a065721e8e6e2137f7b11
3
  size 9891552
build/torch211-cxx11-cu130-aarch64-linux/_ops.py CHANGED
@@ -1,9 +1,9 @@
1
  import torch
2
- from . import _deformable_detr_cuda_86f75d9
3
- ops = torch.ops._deformable_detr_cuda_86f75d9
4
 
5
  def add_op_namespace_prefix(op_name: str):
6
  """
7
  Prefix op by namespace.
8
  """
9
- return f"_deformable_detr_cuda_86f75d9::{op_name}"
 
1
  import torch
2
+ from . import _deformable_detr_cuda_c35b54a
3
+ ops = torch.ops._deformable_detr_cuda_c35b54a
4
 
5
  def add_op_namespace_prefix(op_name: str):
6
  """
7
  Prefix op by namespace.
8
  """
9
+ return f"_deformable_detr_cuda_c35b54a::{op_name}"
build/torch211-cxx11-cu130-aarch64-linux/metadata.json CHANGED
@@ -1,6 +1,6 @@
1
  {
2
  "name": "deformable-detr",
3
- "id": "_deformable_detr_cuda_86f75d9",
4
  "version": 1,
5
  "license": "Apache-2.0",
6
  "python-depends": [],
 
1
  {
2
  "name": "deformable-detr",
3
+ "id": "_deformable_detr_cuda_c35b54a",
4
  "version": 1,
5
  "license": "Apache-2.0",
6
  "python-depends": [],
build/torch212-cxx11-cu126-aarch64-linux/__init__.py ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import List
2
+ import torch
3
+
4
+ from ._ops import ops
5
+ from . import layers
6
+
7
+
8
+ def ms_deform_attn_backward(
9
+ value: torch.Tensor,
10
+ spatial_shapes: torch.Tensor,
11
+ level_start_index: torch.Tensor,
12
+ sampling_loc: torch.Tensor,
13
+ attn_weight: torch.Tensor,
14
+ grad_output: torch.Tensor,
15
+ im2col_step: int,
16
+ ) -> List[torch.Tensor]:
17
+ return ops.ms_deform_attn_backward(
18
+ value,
19
+ spatial_shapes,
20
+ level_start_index,
21
+ sampling_loc,
22
+ attn_weight,
23
+ grad_output,
24
+ im2col_step,
25
+ )
26
+
27
+
28
+ def ms_deform_attn_forward(
29
+ value: torch.Tensor,
30
+ spatial_shapes: torch.Tensor,
31
+ level_start_index: torch.Tensor,
32
+ sampling_loc: torch.Tensor,
33
+ attn_weight: torch.Tensor,
34
+ im2col_step: int,
35
+ ) -> torch.Tensor:
36
+ return ops.ms_deform_attn_forward(
37
+ value,
38
+ spatial_shapes,
39
+ level_start_index,
40
+ sampling_loc,
41
+ attn_weight,
42
+ im2col_step,
43
+ )
44
+
45
+
46
+ __all__ = ["layers", "ms_deform_attn_forward", "ms_deform_attn_backward"]
build/torch212-cxx11-cu126-aarch64-linux/_deformable_detr_cuda_c35b54a.abi3.so ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:25570d02c333bf8a76d1d894778ad7eaeb7a87a8d2d63e4b13c0d4cb28187b9d
3
+ size 8606640
build/torch212-cxx11-cu126-aarch64-linux/_ops.py ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ import torch
2
+ from . import _deformable_detr_cuda_c35b54a
3
+ ops = torch.ops._deformable_detr_cuda_c35b54a
4
+
5
+ def add_op_namespace_prefix(op_name: str):
6
+ """
7
+ Prefix op by namespace.
8
+ """
9
+ return f"_deformable_detr_cuda_c35b54a::{op_name}"
build/torch212-cxx11-cu126-aarch64-linux/deformable_detr/__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/torch212-cxx11-cu126-aarch64-linux/layers.py ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import List, Union, Tuple
2
+
3
+ from torch import Tensor
4
+ from torch.autograd import Function
5
+ from torch.autograd.function import once_differentiable
6
+ import torch.nn as nn
7
+
8
+ from ._ops import ops
9
+
10
+
11
+ class MultiScaleDeformableAttentionFunction(Function):
12
+ @staticmethod
13
+ def forward(
14
+ context,
15
+ value: Tensor,
16
+ value_spatial_shapes: Tensor,
17
+ value_level_start_index: Tensor,
18
+ sampling_locations: Tensor,
19
+ attention_weights: Tensor,
20
+ im2col_step: int,
21
+ ):
22
+ context.im2col_step = im2col_step
23
+ output = ops.ms_deform_attn_forward(
24
+ value,
25
+ value_spatial_shapes,
26
+ value_level_start_index,
27
+ sampling_locations,
28
+ attention_weights,
29
+ context.im2col_step,
30
+ )
31
+ context.save_for_backward(
32
+ value,
33
+ value_spatial_shapes,
34
+ value_level_start_index,
35
+ sampling_locations,
36
+ attention_weights,
37
+ )
38
+ return output
39
+
40
+ @staticmethod
41
+ @once_differentiable
42
+ def backward(context, grad_output):
43
+ (
44
+ value,
45
+ value_spatial_shapes,
46
+ value_level_start_index,
47
+ sampling_locations,
48
+ attention_weights,
49
+ ) = context.saved_tensors
50
+ grad_value, grad_sampling_loc, grad_attn_weight = ops.ms_deform_attn_backward(
51
+ value,
52
+ value_spatial_shapes,
53
+ value_level_start_index,
54
+ sampling_locations,
55
+ attention_weights,
56
+ grad_output,
57
+ context.im2col_step,
58
+ )
59
+
60
+ return grad_value, None, None, grad_sampling_loc, grad_attn_weight, None
61
+
62
+
63
+ class MultiScaleDeformableAttention(nn.Module):
64
+ def forward(
65
+ self,
66
+ value: Tensor,
67
+ value_spatial_shapes: Tensor,
68
+ value_spatial_shapes_list: List[Tuple],
69
+ level_start_index: Tensor,
70
+ sampling_locations: Tensor,
71
+ attention_weights: Tensor,
72
+ im2col_step: int,
73
+ ):
74
+ return MultiScaleDeformableAttentionFunction.apply(
75
+ value,
76
+ value_spatial_shapes,
77
+ level_start_index,
78
+ sampling_locations,
79
+ attention_weights,
80
+ im2col_step,
81
+ )
82
+
83
+
84
+ __all__ = ["MultiScaleDeformableAttention"]
build/torch212-cxx11-cu126-aarch64-linux/metadata.json ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "deformable-detr",
3
+ "id": "_deformable_detr_cuda_c35b54a",
4
+ "version": 1,
5
+ "license": "Apache-2.0",
6
+ "python-depends": [],
7
+ "backend": {
8
+ "type": "cuda",
9
+ "archs": [
10
+ "7.0",
11
+ "7.2",
12
+ "7.5",
13
+ "8.0",
14
+ "8.6",
15
+ "8.7",
16
+ "8.9",
17
+ "9.0+PTX"
18
+ ]
19
+ }
20
+ }
build/torch212-cxx11-cu130-aarch64-linux/__init__.py ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import List
2
+ import torch
3
+
4
+ from ._ops import ops
5
+ from . import layers
6
+
7
+
8
+ def ms_deform_attn_backward(
9
+ value: torch.Tensor,
10
+ spatial_shapes: torch.Tensor,
11
+ level_start_index: torch.Tensor,
12
+ sampling_loc: torch.Tensor,
13
+ attn_weight: torch.Tensor,
14
+ grad_output: torch.Tensor,
15
+ im2col_step: int,
16
+ ) -> List[torch.Tensor]:
17
+ return ops.ms_deform_attn_backward(
18
+ value,
19
+ spatial_shapes,
20
+ level_start_index,
21
+ sampling_loc,
22
+ attn_weight,
23
+ grad_output,
24
+ im2col_step,
25
+ )
26
+
27
+
28
+ def ms_deform_attn_forward(
29
+ value: torch.Tensor,
30
+ spatial_shapes: torch.Tensor,
31
+ level_start_index: torch.Tensor,
32
+ sampling_loc: torch.Tensor,
33
+ attn_weight: torch.Tensor,
34
+ im2col_step: int,
35
+ ) -> torch.Tensor:
36
+ return ops.ms_deform_attn_forward(
37
+ value,
38
+ spatial_shapes,
39
+ level_start_index,
40
+ sampling_loc,
41
+ attn_weight,
42
+ im2col_step,
43
+ )
44
+
45
+
46
+ __all__ = ["layers", "ms_deform_attn_forward", "ms_deform_attn_backward"]
build/torch212-cxx11-cu130-aarch64-linux/_deformable_detr_cuda_c35b54a.abi3.so ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a17b5cf9073ab3c77746a5716c919784d0bbd1cc045df5a632c7a73a4a4a80e3
3
+ size 9891672
build/torch212-cxx11-cu130-aarch64-linux/_ops.py ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ import torch
2
+ from . import _deformable_detr_cuda_c35b54a
3
+ ops = torch.ops._deformable_detr_cuda_c35b54a
4
+
5
+ def add_op_namespace_prefix(op_name: str):
6
+ """
7
+ Prefix op by namespace.
8
+ """
9
+ return f"_deformable_detr_cuda_c35b54a::{op_name}"
build/torch212-cxx11-cu130-aarch64-linux/deformable_detr/__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/torch212-cxx11-cu130-aarch64-linux/layers.py ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import List, Union, Tuple
2
+
3
+ from torch import Tensor
4
+ from torch.autograd import Function
5
+ from torch.autograd.function import once_differentiable
6
+ import torch.nn as nn
7
+
8
+ from ._ops import ops
9
+
10
+
11
+ class MultiScaleDeformableAttentionFunction(Function):
12
+ @staticmethod
13
+ def forward(
14
+ context,
15
+ value: Tensor,
16
+ value_spatial_shapes: Tensor,
17
+ value_level_start_index: Tensor,
18
+ sampling_locations: Tensor,
19
+ attention_weights: Tensor,
20
+ im2col_step: int,
21
+ ):
22
+ context.im2col_step = im2col_step
23
+ output = ops.ms_deform_attn_forward(
24
+ value,
25
+ value_spatial_shapes,
26
+ value_level_start_index,
27
+ sampling_locations,
28
+ attention_weights,
29
+ context.im2col_step,
30
+ )
31
+ context.save_for_backward(
32
+ value,
33
+ value_spatial_shapes,
34
+ value_level_start_index,
35
+ sampling_locations,
36
+ attention_weights,
37
+ )
38
+ return output
39
+
40
+ @staticmethod
41
+ @once_differentiable
42
+ def backward(context, grad_output):
43
+ (
44
+ value,
45
+ value_spatial_shapes,
46
+ value_level_start_index,
47
+ sampling_locations,
48
+ attention_weights,
49
+ ) = context.saved_tensors
50
+ grad_value, grad_sampling_loc, grad_attn_weight = ops.ms_deform_attn_backward(
51
+ value,
52
+ value_spatial_shapes,
53
+ value_level_start_index,
54
+ sampling_locations,
55
+ attention_weights,
56
+ grad_output,
57
+ context.im2col_step,
58
+ )
59
+
60
+ return grad_value, None, None, grad_sampling_loc, grad_attn_weight, None
61
+
62
+
63
+ class MultiScaleDeformableAttention(nn.Module):
64
+ def forward(
65
+ self,
66
+ value: Tensor,
67
+ value_spatial_shapes: Tensor,
68
+ value_spatial_shapes_list: List[Tuple],
69
+ level_start_index: Tensor,
70
+ sampling_locations: Tensor,
71
+ attention_weights: Tensor,
72
+ im2col_step: int,
73
+ ):
74
+ return MultiScaleDeformableAttentionFunction.apply(
75
+ value,
76
+ value_spatial_shapes,
77
+ level_start_index,
78
+ sampling_locations,
79
+ attention_weights,
80
+ im2col_step,
81
+ )
82
+
83
+
84
+ __all__ = ["MultiScaleDeformableAttention"]
build/torch212-cxx11-cu130-aarch64-linux/metadata.json ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "deformable-detr",
3
+ "id": "_deformable_detr_cuda_c35b54a",
4
+ "version": 1,
5
+ "license": "Apache-2.0",
6
+ "python-depends": [],
7
+ "backend": {
8
+ "type": "cuda",
9
+ "archs": [
10
+ "10.0",
11
+ "11.0",
12
+ "12.0+PTX",
13
+ "7.5",
14
+ "8.0",
15
+ "8.6",
16
+ "8.7",
17
+ "8.9",
18
+ "9.0"
19
+ ]
20
+ }
21
+ }
build/torch212-cxx11-cu132-aarch64-linux/__init__.py ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import List
2
+ import torch
3
+
4
+ from ._ops import ops
5
+ from . import layers
6
+
7
+
8
+ def ms_deform_attn_backward(
9
+ value: torch.Tensor,
10
+ spatial_shapes: torch.Tensor,
11
+ level_start_index: torch.Tensor,
12
+ sampling_loc: torch.Tensor,
13
+ attn_weight: torch.Tensor,
14
+ grad_output: torch.Tensor,
15
+ im2col_step: int,
16
+ ) -> List[torch.Tensor]:
17
+ return ops.ms_deform_attn_backward(
18
+ value,
19
+ spatial_shapes,
20
+ level_start_index,
21
+ sampling_loc,
22
+ attn_weight,
23
+ grad_output,
24
+ im2col_step,
25
+ )
26
+
27
+
28
+ def ms_deform_attn_forward(
29
+ value: torch.Tensor,
30
+ spatial_shapes: torch.Tensor,
31
+ level_start_index: torch.Tensor,
32
+ sampling_loc: torch.Tensor,
33
+ attn_weight: torch.Tensor,
34
+ im2col_step: int,
35
+ ) -> torch.Tensor:
36
+ return ops.ms_deform_attn_forward(
37
+ value,
38
+ spatial_shapes,
39
+ level_start_index,
40
+ sampling_loc,
41
+ attn_weight,
42
+ im2col_step,
43
+ )
44
+
45
+
46
+ __all__ = ["layers", "ms_deform_attn_forward", "ms_deform_attn_backward"]
build/torch212-cxx11-cu132-aarch64-linux/_deformable_detr_cuda_c35b54a.abi3.so ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:50b08835f3b62d9201ad56a558381af696ba4b216ae18a6a9e38eeb4a5385e5a
3
+ size 9959808
build/torch212-cxx11-cu132-aarch64-linux/_ops.py ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ import torch
2
+ from . import _deformable_detr_cuda_c35b54a
3
+ ops = torch.ops._deformable_detr_cuda_c35b54a
4
+
5
+ def add_op_namespace_prefix(op_name: str):
6
+ """
7
+ Prefix op by namespace.
8
+ """
9
+ return f"_deformable_detr_cuda_c35b54a::{op_name}"
build/torch212-cxx11-cu132-aarch64-linux/deformable_detr/__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/torch212-cxx11-cu132-aarch64-linux/layers.py ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import List, Union, Tuple
2
+
3
+ from torch import Tensor
4
+ from torch.autograd import Function
5
+ from torch.autograd.function import once_differentiable
6
+ import torch.nn as nn
7
+
8
+ from ._ops import ops
9
+
10
+
11
+ class MultiScaleDeformableAttentionFunction(Function):
12
+ @staticmethod
13
+ def forward(
14
+ context,
15
+ value: Tensor,
16
+ value_spatial_shapes: Tensor,
17
+ value_level_start_index: Tensor,
18
+ sampling_locations: Tensor,
19
+ attention_weights: Tensor,
20
+ im2col_step: int,
21
+ ):
22
+ context.im2col_step = im2col_step
23
+ output = ops.ms_deform_attn_forward(
24
+ value,
25
+ value_spatial_shapes,
26
+ value_level_start_index,
27
+ sampling_locations,
28
+ attention_weights,
29
+ context.im2col_step,
30
+ )
31
+ context.save_for_backward(
32
+ value,
33
+ value_spatial_shapes,
34
+ value_level_start_index,
35
+ sampling_locations,
36
+ attention_weights,
37
+ )
38
+ return output
39
+
40
+ @staticmethod
41
+ @once_differentiable
42
+ def backward(context, grad_output):
43
+ (
44
+ value,
45
+ value_spatial_shapes,
46
+ value_level_start_index,
47
+ sampling_locations,
48
+ attention_weights,
49
+ ) = context.saved_tensors
50
+ grad_value, grad_sampling_loc, grad_attn_weight = ops.ms_deform_attn_backward(
51
+ value,
52
+ value_spatial_shapes,
53
+ value_level_start_index,
54
+ sampling_locations,
55
+ attention_weights,
56
+ grad_output,
57
+ context.im2col_step,
58
+ )
59
+
60
+ return grad_value, None, None, grad_sampling_loc, grad_attn_weight, None
61
+
62
+
63
+ class MultiScaleDeformableAttention(nn.Module):
64
+ def forward(
65
+ self,
66
+ value: Tensor,
67
+ value_spatial_shapes: Tensor,
68
+ value_spatial_shapes_list: List[Tuple],
69
+ level_start_index: Tensor,
70
+ sampling_locations: Tensor,
71
+ attention_weights: Tensor,
72
+ im2col_step: int,
73
+ ):
74
+ return MultiScaleDeformableAttentionFunction.apply(
75
+ value,
76
+ value_spatial_shapes,
77
+ level_start_index,
78
+ sampling_locations,
79
+ attention_weights,
80
+ im2col_step,
81
+ )
82
+
83
+
84
+ __all__ = ["MultiScaleDeformableAttention"]
build/torch212-cxx11-cu132-aarch64-linux/metadata.json ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "deformable-detr",
3
+ "id": "_deformable_detr_cuda_c35b54a",
4
+ "version": 1,
5
+ "license": "Apache-2.0",
6
+ "python-depends": [],
7
+ "backend": {
8
+ "type": "cuda",
9
+ "archs": [
10
+ "10.0",
11
+ "11.0",
12
+ "12.0+PTX",
13
+ "7.5",
14
+ "8.0",
15
+ "8.6",
16
+ "8.7",
17
+ "8.9",
18
+ "9.0"
19
+ ]
20
+ }
21
+ }