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
729b4fb2
"src/git@developer.sourcefind.cn:renzhc/diffusers_dcu.git" did not exist on "beb8f216ed07931f6d8fd5633faf31906981abb0"
Commit
729b4fb2
authored
Jan 24, 2020
by
rusty1s
Browse files
faster transpose
parent
fc650310
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
2 deletions
+6
-2
torch_sparse/transpose.py
torch_sparse/transpose.py
+6
-2
No files found.
torch_sparse/transpose.py
View file @
729b4fb2
...
@@ -29,11 +29,15 @@ def transpose(index, value, m, n, coalesced=True):
...
@@ -29,11 +29,15 @@ def transpose(index, value, m, n, coalesced=True):
def
t
(
src
):
def
t
(
src
):
(
row
,
col
)
,
value
=
src
.
coo
()
index
,
value
=
src
.
coo
()
csr2csc
=
src
.
storage
.
csr2csc
csr2csc
=
src
.
storage
.
csr2csc
new_index
=
torch
.
empty_like
(
index
)
torch
.
index_select
(
index
[
1
],
0
,
csr2csc
,
out
=
new_index
[
0
])
torch
.
index_select
(
index
[
0
],
0
,
csr2csc
,
out
=
new_index
[
1
])
storage
=
src
.
storage
.
__class__
(
storage
=
src
.
storage
.
__class__
(
index
=
torch
.
stack
([
col
,
row
],
dim
=
0
)[:,
csr2csc
]
,
index
=
new_index
,
value
=
value
[
csr2csc
]
if
src
.
has_value
()
else
None
,
value
=
value
[
csr2csc
]
if
src
.
has_value
()
else
None
,
sparse_size
=
src
.
sparse_size
()[::
-
1
],
sparse_size
=
src
.
sparse_size
()[::
-
1
],
rowcount
=
src
.
storage
.
_colcount
,
rowcount
=
src
.
storage
.
_colcount
,
...
...
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