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-scatter
Commits
bc666bf5
Commit
bc666bf5
authored
Dec 16, 2017
by
rusty1s
Browse files
update for pytorch 0.3
parent
b4e5e1df
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
3 deletions
+6
-3
torch_scatter/src/cpu.c
torch_scatter/src/cpu.c
+3
-1
torch_scatter/src/generic/cpu.c
torch_scatter/src/generic/cpu.c
+3
-2
No files found.
torch_scatter/src/cpu.c
View file @
bc666bf5
#include <TH/TH.h>
#include "THTensorDimApply.h"
#define scatter_(NAME) TH_CONCAT_4(scatter_, NAME, _, Real)
inline
void
assertInBoundaries
(
int
idx
,
int
size
,
long
*
free
)
{
inline
void
assertIn
dexIn
Boundaries
(
int
idx
,
int
size
,
long
*
free
)
{
if
(
idx
<
0
||
idx
>=
size
)
{
THFree
(
free
);
THError
(
"Invalid index"
);
}
}
...
...
torch_scatter/src/generic/cpu.c
View file @
bc666bf5
...
...
@@ -4,10 +4,11 @@
void
scatter_
(
add
)(
THTensor
*
output
,
THLongTensor
*
index
,
THTensor
*
input
,
int
dim
)
{
long
idx
;
TH_TENSOR_DIM_APPLY3
(
real
,
output
,
real
,
input
,
long
,
index
,
dim
,
TH_TENSOR_DIM_APPLY3
(
real
,
output
,
real
,
input
,
int64_t
,
index
,
dim
,
TH_TENSOR_DIM_APPLY3_SIZE_EQ_EXCEPT_DIM
,
for
(
int
i
=
0
;
i
<
THLongTensor_size
(
index
,
dim
);
i
++
)
{
idx
=
*
(
index_data
+
i
*
index_stride
);
assertInBoundaries
(
idx
,
output_size
,
TH_TENSOR_DIM_APPLY_counter
);
assertIn
dexIn
Boundaries
(
idx
,
output_size
,
TH_TENSOR_DIM_APPLY_counter
);
output_data
[
idx
]
+=
*
(
input_data
+
i
*
input_stride
);
})
}
...
...
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