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
801970bf
Commit
801970bf
authored
Jan 26, 2020
by
rusty1s
Browse files
add fix
parent
8481d0d6
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
torch_sparse/add.py
torch_sparse/add.py
+4
-4
No files found.
torch_sparse/add.py
View file @
801970bf
...
@@ -42,9 +42,9 @@ def add(src, other):
...
@@ -42,9 +42,9 @@ def add(src, other):
return
add_nnz
(
src
,
other
)
return
add_nnz
(
src
,
other
)
elif
torch
.
is_tensor
(
other
):
elif
torch
.
is_tensor
(
other
):
(
row
,
col
)
,
value
=
src
.
c
oo
()
row
ptr
,
col
,
value
=
src
.
c
sr
()
if
other
.
size
(
0
)
==
src
.
size
(
0
)
and
other
.
size
(
1
)
==
1
:
# Row-wise...
if
other
.
size
(
0
)
==
src
.
size
(
0
)
and
other
.
size
(
1
)
==
1
:
# Row-wise...
other
=
gather_csr
(
other
.
squeeze
(
1
),
src
.
storage
.
rowptr
)
other
=
gather_csr
(
other
.
squeeze
(
1
),
rowptr
)
value
=
other
.
add_
(
src
.
storage
.
value
if
src
.
has_value
()
else
1
)
value
=
other
.
add_
(
src
.
storage
.
value
if
src
.
has_value
()
else
1
)
return
src
.
set_value
(
value
,
layout
=
'csr'
)
return
src
.
set_value
(
value
,
layout
=
'csr'
)
...
@@ -69,9 +69,9 @@ def add_(src, other):
...
@@ -69,9 +69,9 @@ def add_(src, other):
return
add_nnz_
(
src
,
other
)
return
add_nnz_
(
src
,
other
)
elif
torch
.
is_tensor
(
other
):
elif
torch
.
is_tensor
(
other
):
(
row
,
col
)
,
value
=
src
.
c
oo
()
row
ptr
,
col
,
value
=
src
.
c
sr
()
if
other
.
size
(
0
)
==
src
.
size
(
0
)
and
other
.
size
(
1
)
==
1
:
# Row-wise...
if
other
.
size
(
0
)
==
src
.
size
(
0
)
and
other
.
size
(
1
)
==
1
:
# Row-wise...
other
=
gather_csr
(
other
.
squeeze
(
1
),
src
.
storage
.
rowptr
)
other
=
gather_csr
(
other
.
squeeze
(
1
),
rowptr
)
if
src
.
has_value
():
if
src
.
has_value
():
value
=
src
.
storage
.
value
.
add_
(
other
)
value
=
src
.
storage
.
value
.
add_
(
other
)
else
:
else
:
...
...
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