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
dfa5e1d4
"git@developer.sourcefind.cn:change/sglang.git" did not exist on "b0feda090caf429cf560ae66789205c0814bd215"
Unverified
Commit
dfa5e1d4
authored
Feb 13, 2020
by
Matthias Fey
Committed by
GitHub
Feb 13, 2020
Browse files
Merge pull request #115 from rusty1s/travis
Travis
parents
e53717b5
52d39ac4
Changes
21
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
28 deletions
+3
-28
torch_scatter/segment_csr.py
torch_scatter/segment_csr.py
+3
-28
No files found.
torch_scatter/segment_csr.py
View file @
dfa5e1d4
import
warnings
import
importlib
import
os.path
as
osp
import
os.path
as
osp
from
typing
import
Optional
,
Tuple
from
typing
import
Optional
,
Tuple
import
torch
import
torch
try
:
torch
.
ops
.
load_library
(
importlib
.
machinery
.
PathFinder
().
find_spec
(
torch
.
ops
.
load_library
(
'_segment_csr'
,
[
osp
.
dirname
(
__file__
)]).
origin
)
osp
.
join
(
osp
.
dirname
(
osp
.
abspath
(
__file__
)),
'_segment_csr.so'
))
except
OSError
:
warnings
.
warn
(
'Failed to load `segment_csr` binaries.'
)
def
segment_csr_placeholder
(
src
:
torch
.
Tensor
,
indptr
:
torch
.
Tensor
,
out
:
Optional
[
torch
.
Tensor
])
->
torch
.
Tensor
:
raise
ImportError
return
src
def
segment_csr_with_arg_placeholder
(
src
:
torch
.
Tensor
,
indptr
:
torch
.
Tensor
,
out
:
Optional
[
torch
.
Tensor
])
->
Tuple
[
torch
.
Tensor
,
torch
.
Tensor
]:
raise
ImportError
return
src
,
indptr
def
gather_csr_placeholder
(
src
:
torch
.
Tensor
,
indptr
:
torch
.
Tensor
,
out
:
Optional
[
torch
.
Tensor
])
->
torch
.
Tensor
:
raise
ImportError
return
src
torch
.
ops
.
torch_scatter
.
segment_sum_csr
=
segment_csr_placeholder
torch
.
ops
.
torch_scatter
.
segment_mean_csr
=
segment_csr_placeholder
torch
.
ops
.
torch_scatter
.
segment_min_csr
=
segment_csr_with_arg_placeholder
torch
.
ops
.
torch_scatter
.
segment_max_csr
=
segment_csr_with_arg_placeholder
torch
.
ops
.
torch_scatter
.
gather_csr
=
gather_csr_placeholder
@
torch
.
jit
.
script
@
torch
.
jit
.
script
...
...
Prev
1
2
Next
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