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
dgl
Commits
e65fc9ff
Unverified
Commit
e65fc9ff
authored
Dec 29, 2022
by
czkkkkkk
Committed by
GitHub
Dec 29, 2022
Browse files
[Sparse] Avoid using macros in DGL headers (#5087)
parent
255ad1b3
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
3 deletions
+9
-3
dgl_sparse/src/spspmm.cc
dgl_sparse/src/spspmm.cc
+9
-3
No files found.
dgl_sparse/src/spspmm.cc
View file @
e65fc9ff
...
...
@@ -67,9 +67,15 @@ torch::Tensor _CSRMask(
auto
row
=
TorchTensorToDGLArray
(
sub_mat
->
COOPtr
()
->
row
);
auto
col
=
TorchTensorToDGLArray
(
sub_mat
->
COOPtr
()
->
col
);
runtime
::
NDArray
ret
;
ATEN_FLOAT_TYPE_SWITCH
(
val
->
dtype
,
DType
,
"Value Type"
,
{
ret
=
aten
::
CSRGetData
<
DType
>
(
csr
,
row
,
col
,
val
,
0.
);
});
if
(
val
->
dtype
.
bits
==
32
)
{
ret
=
aten
::
CSRGetData
<
float
>
(
csr
,
row
,
col
,
val
,
0.
);
}
else
if
(
val
->
dtype
.
bits
==
64
)
{
ret
=
aten
::
CSRGetData
<
double
>
(
csr
,
row
,
col
,
val
,
0.
);
}
else
{
TORCH_CHECK
(
false
,
"Dtype of value for SpSpMM should be 32 or 64 bits but got: "
+
std
::
to_string
(
val
->
dtype
.
bits
));
}
return
DGLArrayToTorchTensor
(
ret
);
}
...
...
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