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
56ae40e7
Commit
56ae40e7
authored
Jan 13, 2018
by
rusty1s
Browse files
grid impl
parent
ea62b22d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
10 deletions
+22
-10
build.py
build.py
+2
-2
torch_cluster/src/cpu.h
torch_cluster/src/cpu.h
+7
-7
torch_cluster/src/generic/cpu.c
torch_cluster/src/generic/cpu.c
+13
-1
No files found.
build.py
View file @
56ae40e7
...
...
@@ -3,8 +3,8 @@ import subprocess
import
torch
from
torch.utils.ffi
import
create_extension
headers
=
[]
sources
=
[]
headers
=
[
'torch_cluster/src/cpu.h'
]
sources
=
[
'torch_cluster/src/cpu.c'
]
include_dirs
=
[
'torch_cluster/src'
]
define_macros
=
[]
extra_objects
=
[]
...
...
torch_cluster/src/cpu.h
View file @
56ae40e7
void
cluster_grid_Float
(
int
C
,
THLongTensor
*
output
,
THFloatTensor
*
position
,
THFloatTensor
*
size
);
void
cluster_grid_Double
(
int
C
,
THLongTensor
*
output
,
THDoubleTensor
*
position
,
THDoubleTensor
*
size
);
void
cluster_grid_Byte
(
int
C
,
THLongTensor
*
output
,
THByteTensor
*
position
,
THByteTensor
*
size
);
void
cluster_grid_Char
(
int
C
,
THLongTensor
*
output
,
THCharTensor
*
position
,
THCharTensor
*
size
);
void
cluster_grid_Short
(
int
C
,
THLongTensor
*
output
,
THShortTensor
*
position
,
THShortTensor
*
size
);
void
cluster_grid_Int
(
int
C
,
THLongTensor
*
output
,
THIntTensor
*
position
,
THIntTensor
*
size
);
void
cluster_grid_Long
(
int
C
,
THLongTensor
*
output
,
THLongTensor
*
position
,
THLongTensor
*
size
);
void
cluster_grid_Float
(
int
C
,
THLongTensor
*
output
,
THFloatTensor
*
position
,
THFloatTensor
*
size
,
THLongTensor
*
count
);
void
cluster_grid_Double
(
int
C
,
THLongTensor
*
output
,
THDoubleTensor
*
position
,
THDoubleTensor
*
size
,
THLongTensor
*
count
);
void
cluster_grid_Byte
(
int
C
,
THLongTensor
*
output
,
THByteTensor
*
position
,
THByteTensor
*
size
,
THLongTensor
*
count
);
void
cluster_grid_Char
(
int
C
,
THLongTensor
*
output
,
THCharTensor
*
position
,
THCharTensor
*
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_Long
(
int
C
,
THLongTensor
*
output
,
THLongTensor
*
position
,
THLongTensor
*
size
,
THLongTensor
*
count
);
torch_cluster/src/generic/cpu.c
View file @
56ae40e7
...
...
@@ -2,7 +2,19 @@
#define TH_GENERIC_FILE "generic/cpu.c"
#else
void
cluster_
(
grid
)(
int
C
,
THLongTensor
*
output
,
THTensor
*
position
,
THTensor
*
size
)
{
void
cluster_
(
grid
)(
int
C
,
THLongTensor
*
output
,
THTensor
*
position
,
THTensor
*
size
,
THLongTensor
*
count
)
{
real
*
size_data
=
size
->
storage
->
data
+
size
->
storageOffset
;
int64_t
*
count_data
=
count
->
storage
->
data
+
count
->
storageOffset
;
int64_t
d
,
i
,
c
,
tmp
;
d
=
THTensor_
(
size
)(
position
,
1
);
TH_TENSOR_DIM_APPLY2
(
int64_t
,
output
,
real
,
position
,
1
,
tmp
=
C
;
c
=
0
;
for
(
i
=
0
;
i
<
d
;
i
++
)
{
tmp
=
tmp
/
*
(
count_data
+
i
);
c
+=
tmp
*
(
int64_t
)
floor
((
float
)(
*
(
position_data
+
i
*
position_stride
)
/
*
(
size_data
+
i
)));
}
output_data
[
0
]
=
c
;
)
}
#endif
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