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
546db4dc
Commit
546db4dc
authored
Mar 25, 2018
by
rusty1s
Browse files
added serial cluster implementation (edge-wise), should ne however node-wise
parent
d4cfecaa
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
0 deletions
+17
-0
torch_cluster/src/cpu.c
torch_cluster/src/cpu.c
+15
-0
torch_cluster/src/cpu.h
torch_cluster/src/cpu.h
+2
-0
No files found.
torch_cluster/src/cpu.c
View file @
546db4dc
...
@@ -2,5 +2,20 @@
...
@@ -2,5 +2,20 @@
#define cluster_(NAME) TH_CONCAT_4(cluster_, NAME, _, Real)
#define cluster_(NAME) TH_CONCAT_4(cluster_, NAME, _, Real)
void
cluster_serial
(
THLongTensor
*
output
,
THLongTensor
*
row
,
THLongTensor
*
col
)
{
int64_t
*
output_data
=
output
->
storage
->
data
+
output
->
storageOffset
;
int64_t
*
row_data
=
row
->
storage
->
data
+
row
->
storageOffset
;
int64_t
*
col_data
=
col
->
storage
->
data
+
col
->
storageOffset
;
int64_t
n
,
N
=
THLongTensor_nElement
(
output
),
r
,
c
,
value
;
for
(
n
=
0
;
n
<
N
;
n
++
)
{
r
=
row_data
[
n
];
c
=
col_data
[
c
];
if
(
output_data
[
r
]
==
-
1
&&
output_data
[
c
]
==
-
1
)
{
value
=
r
<
c
?
r
:
c
;
output_data
[
r
]
=
value
;
output_data
[
c
]
=
value
;
}
}
}
#include "generic/cpu.c"
#include "generic/cpu.c"
#include "THGenerateAllTypes.h"
#include "THGenerateAllTypes.h"
torch_cluster/src/cpu.h
View file @
546db4dc
...
@@ -5,3 +5,5 @@ void cluster_grid_Char (int C, THLongTensor *output, THCharTensor *position,
...
@@ -5,3 +5,5 @@ void cluster_grid_Char (int C, THLongTensor *output, THCharTensor *position,
void
cluster_grid_Short
(
int
C
,
THLongTensor
*
output
,
THShortTensor
*
position
,
THShortTensor
*
size
,
THLongTensor
*
count
);
void
cluster_grid_Short
(
int
C
,
THLongTensor
*
output
,
THShortTensor
*
position
,
THShortTensor
*
size
,
THLongTensor
*
count
);
void
cluster_grid_Int
(
int
C
,
THLongTensor
*
output
,
THIntTensor
*
position
,
THIntTensor
*
size
,
THLongTensor
*
count
);
void
cluster_grid_Int
(
int
C
,
THLongTensor
*
output
,
THIntTensor
*
position
,
THIntTensor
*
size
,
THLongTensor
*
count
);
void
cluster_grid_Long
(
int
C
,
THLongTensor
*
output
,
THLongTensor
*
position
,
THLongTensor
*
size
,
THLongTensor
*
count
);
void
cluster_grid_Long
(
int
C
,
THLongTensor
*
output
,
THLongTensor
*
position
,
THLongTensor
*
size
,
THLongTensor
*
count
);
void
cluster_serial
(
THLongTensor
*
output
,
THLongTensor
*
row
,
THLongTensor
*
col
);
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