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
4c8e5298
Commit
4c8e5298
authored
Aug 23, 2021
by
rusty1s
Browse files
fix set_diag for nnz=0
parent
6456fb4a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
0 deletions
+3
-0
csrc/cuda/diag_cuda.cu
csrc/cuda/diag_cuda.cu
+3
-0
No files found.
csrc/cuda/diag_cuda.cu
View file @
4c8e5298
...
@@ -54,6 +54,9 @@ torch::Tensor non_diag_mask_cuda(torch::Tensor row, torch::Tensor col,
...
@@ -54,6 +54,9 @@ torch::Tensor non_diag_mask_cuda(torch::Tensor row, torch::Tensor col,
auto
mask
=
torch
::
zeros
(
E
+
num_diag
,
row
.
options
().
dtype
(
torch
::
kBool
));
auto
mask
=
torch
::
zeros
(
E
+
num_diag
,
row
.
options
().
dtype
(
torch
::
kBool
));
auto
mask_data
=
mask
.
data_ptr
<
bool
>
();
auto
mask_data
=
mask
.
data_ptr
<
bool
>
();
if
(
E
==
0
)
return
mask
;
auto
stream
=
at
::
cuda
::
getCurrentCUDAStream
();
auto
stream
=
at
::
cuda
::
getCurrentCUDAStream
();
non_diag_mask_kernel
<<<
(
E
+
THREADS
-
1
)
/
THREADS
,
THREADS
,
0
,
stream
>>>
(
non_diag_mask_kernel
<<<
(
E
+
THREADS
-
1
)
/
THREADS
,
THREADS
,
0
,
stream
>>>
(
row_data
,
col_data
,
mask_data
,
N
,
k
,
num_diag
,
E
);
row_data
,
col_data
,
mask_data
,
N
,
k
,
num_diag
,
E
);
...
...
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