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-sparse
Commits
f6bf81df
Commit
f6bf81df
authored
Jan 28, 2020
by
rusty1s
Browse files
move imports
parent
411dcb76
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
15 deletions
+15
-15
torch_sparse/__init__.py
torch_sparse/__init__.py
+15
-0
torch_sparse/utils.py
torch_sparse/utils.py
+0
-15
No files found.
torch_sparse/__init__.py
View file @
f6bf81df
import
torch
torch
.
ops
.
load_library
(
'torch_sparse/convert_cpu.so'
)
torch
.
ops
.
load_library
(
'torch_sparse/diag_cpu.so'
)
torch
.
ops
.
load_library
(
'torch_sparse/spmm_cpu.so'
)
try
:
torch
.
ops
.
load_library
(
'torch_sparse/convert_cuda.so'
)
torch
.
ops
.
load_library
(
'torch_sparse/diag_cuda.so'
)
torch
.
ops
.
load_library
(
'torch_sparse/spmm_cuda.so'
)
torch
.
ops
.
load_library
(
'torch_sparse/spspmm_cuda.so'
)
except
OSError
as
e
:
if
torch
.
cuda
.
is_available
():
raise
e
from
.convert
import
to_torch_sparse
,
from_torch_sparse
,
to_scipy
,
from_scipy
from
.convert
import
to_torch_sparse
,
from_torch_sparse
,
to_scipy
,
from_scipy
from
.coalesce
import
coalesce
from
.coalesce
import
coalesce
from
.transpose
import
transpose
from
.transpose
import
transpose
...
...
torch_sparse/utils.py
View file @
f6bf81df
from
typing
import
Any
from
typing
import
Any
import
torch
try
:
try
:
from
typing_extensions
import
Final
# noqa
from
typing_extensions
import
Final
# noqa
except
ImportError
:
except
ImportError
:
from
torch.jit
import
Final
# noqa
from
torch.jit
import
Final
# noqa
torch
.
ops
.
load_library
(
'torch_sparse/convert_cpu.so'
)
torch
.
ops
.
load_library
(
'torch_sparse/diag_cpu.so'
)
torch
.
ops
.
load_library
(
'torch_sparse/spmm_cpu.so'
)
try
:
torch
.
ops
.
load_library
(
'torch_sparse/convert_cuda.so'
)
torch
.
ops
.
load_library
(
'torch_sparse/diag_cuda.so'
)
torch
.
ops
.
load_library
(
'torch_sparse/spmm_cuda.so'
)
torch
.
ops
.
load_library
(
'torch_sparse/spspmm_cuda.so'
)
except
OSError
as
e
:
if
torch
.
cuda
.
is_available
():
raise
e
def
is_scalar
(
other
:
Any
)
->
bool
:
def
is_scalar
(
other
:
Any
)
->
bool
:
return
isinstance
(
other
,
int
)
or
isinstance
(
other
,
float
)
return
isinstance
(
other
,
int
)
or
isinstance
(
other
,
float
)
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