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
22c497dd
Commit
22c497dd
authored
Mar 30, 2018
by
rusty1s
Browse files
added getData macro
parent
8b5daa16
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
19 additions
and
11 deletions
+19
-11
aten/TH/THGreedy.c
aten/TH/THGreedy.c
+6
-5
aten/TH/THGrid.c
aten/TH/THGrid.c
+2
-1
aten/TH/common.h
aten/TH/common.h
+6
-0
aten/TH/generic/THGreedy.c
aten/TH/generic/THGreedy.c
+1
-1
aten/TH/generic/THGrid.c
aten/TH/generic/THGrid.c
+4
-4
No files found.
aten/TH/THGreedy.c
View file @
22c497dd
#include <TH/TH.h>
#include <TH/TH.h>
#include "common.h"
#define THGreedy_ TH_CONCAT_3(TH,Real,Greedy)
#define THGreedy_ TH_CONCAT_3(TH,Real,Greedy)
#define DATA(TENSOR) TENSOR->storage->data + TENSOR->storageOffset
#define TH_GREEDY_CLUSTER(cluster, row, col, deg, SELECT) { \
#define TH_GREEDY_CLUSTER(cluster, row, col, deg, SELECT) { \
THLongTensor_fill(cluster, -1); \
THLongTensor_fill(cluster, -1); \
int64_t *clusterData =
DATA
(cluster); \
int64_t *clusterData =
THTensor_getData
(cluster); \
int64_t *rowData =
DATA
(row); \
int64_t *rowData =
THTensor_getData
(row); \
int64_t *colData =
DATA
(col); \
int64_t *colData =
THTensor_getData
(col); \
int64_t *degData =
DATA
(deg); \
int64_t *degData =
THTensor_getData
(deg); \
ptrdiff_t rowIdx = 0, neighborIdx; \
ptrdiff_t rowIdx = 0, neighborIdx; \
int64_t rowValue, colValue, clusterValue, tmp; \
int64_t rowValue, colValue, clusterValue, tmp; \
while(rowIdx < THLongTensor_nElement(row)) { \
while(rowIdx < THLongTensor_nElement(row)) { \
...
...
aten/TH/THGrid.c
View file @
22c497dd
#include <TH/TH.h>
#include <TH/TH.h>
#include "common.h"
#define THGrid_ TH_CONCAT_3(TH,Real,Grid)
#define THGrid_ TH_CONCAT_3(TH,Real,Grid)
#define DATA(TENSOR) TENSOR->storage->data + TENSOR->storageOffset
#include "generic/THGrid.c"
#include "generic/THGrid.c"
#include "THGenerateAllTypes.h"
#include "THGenerateAllTypes.h"
aten/TH/common.h
0 → 100644
View file @
22c497dd
#ifndef TH_COMMON_INC
#define TH_COMMON_INC
#define THTensor_getData(TENSOR) TENSOR->storage->data + TENSOR->storageOffset
#endif // TH_COMMON_INC
aten/TH/generic/THGreedy.c
View file @
22c497dd
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
void
THGreedy_
(
THLongTensor
*
cluster
,
THLongTensor
*
row
,
THLongTensor
*
col
,
THLongTensor
*
deg
,
void
THGreedy_
(
THLongTensor
*
cluster
,
THLongTensor
*
row
,
THLongTensor
*
col
,
THLongTensor
*
deg
,
THTensor
*
weight
)
{
THTensor
*
weight
)
{
real
*
weightData
=
DATA
(
weight
);
real
*
weightData
=
THTensor_getData
(
weight
);
real
maxWeight
=
0
,
tmpWeight
;
real
maxWeight
=
0
,
tmpWeight
;
TH_GREEDY_CLUSTER
(
cluster
,
row
,
col
,
deg
,
TH_GREEDY_CLUSTER
(
cluster
,
row
,
col
,
deg
,
for
(
neighborIdx
=
rowIdx
;
neighborIdx
<
rowIdx
+
degData
[
rowValue
];
neighborIdx
++
)
{
for
(
neighborIdx
=
rowIdx
;
neighborIdx
<
rowIdx
+
degData
[
rowValue
];
neighborIdx
++
)
{
...
...
aten/TH/generic/THGrid.c
View file @
22c497dd
...
@@ -3,10 +3,10 @@
...
@@ -3,10 +3,10 @@
#else
#else
void
THGrid_
(
THLongTensor
*
cluster
,
THTensor
*
pos
,
THTensor
*
size
,
THLongTensor
*
count
)
{
void
THGrid_
(
THLongTensor
*
cluster
,
THTensor
*
pos
,
THTensor
*
size
,
THLongTensor
*
count
)
{
int64_t
*
clusterData
=
DATA
(
cluster
);
int64_t
*
clusterData
=
THTensor_getData
(
cluster
);
real
*
posData
=
DATA
(
pos
);
real
*
posData
=
THTensor_getData
(
pos
);
real
*
sizeData
=
DATA
(
size
);
real
*
sizeData
=
THTensor_getData
(
size
);
int64_t
*
countData
=
DATA
(
count
);
int64_t
*
countData
=
THTensor_getData
(
count
);
ptrdiff_t
n
,
d
;
int64_t
coef
,
value
;
ptrdiff_t
n
,
d
;
int64_t
coef
,
value
;
for
(
n
=
0
;
n
<
THTensor_
(
size
)(
pos
,
0
);
n
++
)
{
for
(
n
=
0
;
n
<
THTensor_
(
size
)(
pos
,
0
);
n
++
)
{
...
...
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