Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
torch-cluster
Commits
92105bf1
Commit
92105bf1
authored
May 02, 2018
by
rusty1s
Browse files
bugfixes
parent
cb0e5f63
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
1 deletion
+21
-1
aten/cuda/cluster.py
aten/cuda/cluster.py
+20
-0
aten/cuda/cluster_kernel.cu
aten/cuda/cluster_kernel.cu
+1
-1
No files found.
aten/cuda/cluster.py
0 → 100644
View file @
92105bf1
import
torch
import
cluster_cuda
dtype
=
torch
.
float
device
=
torch
.
device
(
'cuda'
)
def
grid_cluster
(
pos
,
size
,
start
=
None
,
end
=
None
):
start
=
pos
.
t
().
min
(
dim
=
1
)[
0
]
if
start
is
None
else
start
end
=
pos
.
t
().
max
(
dim
=
1
)[
0
]
if
end
is
None
else
end
return
cluster_cuda
.
grid
(
pos
,
size
,
start
,
end
)
pos
=
torch
.
tensor
(
[[
1
,
1
],
[
3
,
3
],
[
5
,
5
],
[
7
,
7
]],
dtype
=
dtype
,
device
=
device
)
size
=
torch
.
tensor
([
2
,
2
,
1
,
1
,
4
,
2
,
1
],
dtype
=
dtype
,
device
=
device
)
# print('pos', pos.tolist())
# print('size', size.tolist())
cluster
=
grid_cluster
(
pos
,
size
)
print
(
'result'
,
cluster
.
tolist
(),
cluster
.
type
())
aten/cuda/cluster_kernel.cu
View file @
92105bf1
...
...
@@ -33,7 +33,7 @@ at::Tensor grid_cuda(at::Tensor pos, at::Tensor size, at::Tensor start,
cluster
.
data
<
int64_t
>
(),
at
::
cuda
::
detail
::
getTensorInfo
<
scalar_t
,
int
>
(
pos
),
size
.
toType
(
pos
.
type
()).
data
<
scalar_t
>
(),
start
.
.
toType
(
pos
.
type
()).
data
<
scalar_t
>
(),
start
.
toType
(
pos
.
type
()).
data
<
scalar_t
>
(),
end
.
toType
(
pos
.
type
()).
data
<
scalar_t
>
(),
num_nodes
);
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment