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
d1dd9466
Commit
d1dd9466
authored
Jan 10, 2020
by
rusty1s
Browse files
support more types
parent
0807f87f
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
15 deletions
+6
-15
test/test_segment.py
test/test_segment.py
+1
-2
test/utils.py
test/utils.py
+1
-9
torch_scatter/helpers.py
torch_scatter/helpers.py
+4
-4
No files found.
test/test_segment.py
View file @
d1dd9466
...
...
@@ -5,12 +5,11 @@ import torch
from
torch.autograd
import
gradcheck
from
torch_scatter
import
segment_coo
,
segment_csr
from
.utils
import
tensor
from
.utils
import
tensor
,
dtypes
reductions
=
[
'add'
,
'mean'
,
'min'
,
'max'
]
grad_reductions
=
[
'add'
,
'mean'
]
dtypes
=
[
torch
.
float
]
devices
=
[
torch
.
device
(
'cuda'
)]
tests
=
[
...
...
test/utils.py
View file @
d1dd9466
import
torch
from
torch.testing
import
get_all_dtypes
dtypes
=
get_all_dtypes
()
dtypes
.
remove
(
torch
.
half
)
dtypes
.
remove
(
torch
.
short
)
# PyTorch scatter does not work on short types.
dtypes
.
remove
(
torch
.
bool
)
if
hasattr
(
torch
,
'bfloat16'
):
dtypes
.
remove
(
torch
.
bfloat16
)
dtypes
=
[
torch
.
float
,
torch
.
double
,
torch
.
int
,
torch
.
long
]
grad_dtypes
=
[
torch
.
float
,
torch
.
double
]
devices
=
[
torch
.
device
(
'cpu'
)]
...
...
torch_scatter/helpers.py
View file @
d1dd9466
...
...
@@ -4,12 +4,12 @@ import torch
def
min_value
(
dtype
):
try
:
return
torch
.
finfo
(
dtype
).
min
except
Attribut
eError
:
return
torch
.
info
(
dtype
).
min
except
Typ
eError
:
return
torch
.
i
info
(
dtype
).
min
def
max_value
(
dtype
):
try
:
return
torch
.
finfo
(
dtype
).
max
except
Attribut
eError
:
return
torch
.
info
(
dtype
).
max
except
Typ
eError
:
return
torch
.
i
info
(
dtype
).
max
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