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
152c41ed
Commit
152c41ed
authored
Dec 28, 2017
by
rusty1s
Browse files
bugfixes
parent
cf125967
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
4 deletions
+5
-4
test/utils.py
test/utils.py
+1
-0
torch_scatter/kernel/kernel.cu
torch_scatter/kernel/kernel.cu
+4
-4
No files found.
test/utils.py
View file @
152c41ed
...
...
@@ -2,6 +2,7 @@ import torch
from
torch._tensor_docs
import
tensor_classes
tensors
=
[
t
[:
-
4
]
for
t
in
tensor_classes
]
tensors
.
remove
(
'ShortTensor'
)
# TODO: PyTorch `atomicAdd` bug with short type.
def
Tensor
(
str
,
x
):
...
...
torch_scatter/kernel/kernel.cu
View file @
152c41ed
...
...
@@ -16,7 +16,7 @@
template
<
typename
Real
,
int
Dims
>
__global__
void
mulKernel
(
TensorInfo
<
Real
>
output
,
TensorInfo
<
int64_t
>
index
,
TensorInfo
<
Real
>
input
,
const
int
dim
,
const
int
n
)
{
KERNEL_LOOP
(
i
,
n
)
{
int
outputOffset
=
0
;
int
indexOffset
=
0
;
int
inputOffset
=
0
;
;
int
outputOffset
=
0
;
int
indexOffset
=
0
;
int
inputOffset
=
0
;
IndexToScatterOffsets3
<
Real
,
Real
,
Dims
>::
compute
(
i
,
dim
,
index
,
&
indexOffset
,
input
,
&
inputOffset
,
output
,
&
outputOffset
);
atomicMul
(
&
output
.
data
[
outputOffset
],
input
.
data
[
inputOffset
]);
}
...
...
@@ -25,7 +25,7 @@ __global__ void mulKernel(TensorInfo<Real> output, TensorInfo<int64_t> index, Te
template
<
typename
Real
,
int
Dims
>
__global__
void
divKernel
(
TensorInfo
<
Real
>
output
,
TensorInfo
<
int64_t
>
index
,
TensorInfo
<
Real
>
input
,
const
int
dim
,
const
int
n
)
{
KERNEL_LOOP
(
i
,
n
)
{
int
outputOffset
=
0
;
int
indexOffset
=
0
;
int
inputOffset
=
0
;
;
int
outputOffset
=
0
;
int
indexOffset
=
0
;
int
inputOffset
=
0
;
IndexToScatterOffsets3
<
Real
,
Real
,
Dims
>::
compute
(
i
,
dim
,
index
,
&
indexOffset
,
input
,
&
inputOffset
,
output
,
&
outputOffset
);
atomicDiv
(
&
output
.
data
[
outputOffset
],
input
.
data
[
inputOffset
]);
}
...
...
@@ -44,7 +44,7 @@ __global__ void meanKernel(TensorInfo<Real> output, TensorInfo<int64_t> index, T
template
<
typename
Real
,
int
Dims
>
__global__
void
maxKernel
(
TensorInfo
<
Real
>
output
,
TensorInfo
<
int64_t
>
index
,
TensorInfo
<
Real
>
input
,
const
int
dim
,
const
int
n
)
{
KERNEL_LOOP
(
i
,
n
)
{
int
outputOffset
=
0
;
int
indexOffset
=
0
;
int
inputOffset
=
0
;
;
int
outputOffset
=
0
;
int
indexOffset
=
0
;
int
inputOffset
=
0
;
IndexToScatterOffsets3
<
Real
,
Real
,
Dims
>::
compute
(
i
,
dim
,
index
,
&
indexOffset
,
input
,
&
inputOffset
,
output
,
&
outputOffset
);
atomicMax
(
&
output
.
data
[
outputOffset
],
input
.
data
[
inputOffset
]);
}
...
...
@@ -53,7 +53,7 @@ __global__ void maxKernel(TensorInfo<Real> output, TensorInfo<int64_t> index, Te
template
<
typename
Real
,
int
Dims
>
__global__
void
minKernel
(
TensorInfo
<
Real
>
output
,
TensorInfo
<
int64_t
>
index
,
TensorInfo
<
Real
>
input
,
const
int
dim
,
const
int
n
)
{
KERNEL_LOOP
(
i
,
n
)
{
int
outputOffset
=
0
;
int
indexOffset
=
0
;
int
inputOffset
=
0
;
;
int
outputOffset
=
0
;
int
indexOffset
=
0
;
int
inputOffset
=
0
;
IndexToScatterOffsets3
<
Real
,
Real
,
Dims
>::
compute
(
i
,
dim
,
index
,
&
indexOffset
,
input
,
&
inputOffset
,
output
,
&
outputOffset
);
atomicMin
(
&
output
.
data
[
outputOffset
],
input
.
data
[
inputOffset
]);
}
...
...
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