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-cluster
Commits
27387388
"docs/vscode:/vscode.git/clone" did not exist on "d7117b95ab120230bb7dc6e69c7c4c800397fcbf"
Unverified
Commit
27387388
authored
Aug 22, 2022
by
YanbingJiang
Committed by
GitHub
Aug 22, 2022
Browse files
Add bf16 support for knn_cpu, radius_cpu and graclus_cpu (#144)
parent
eea2fc58
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
5 additions
and
4 deletions
+5
-4
csrc/cpu/graclus_cpu.cpp
csrc/cpu/graclus_cpu.cpp
+1
-1
csrc/cpu/knn_cpu.cpp
csrc/cpu/knn_cpu.cpp
+1
-1
csrc/cpu/radius_cpu.cpp
csrc/cpu/radius_cpu.cpp
+1
-1
test/utils.py
test/utils.py
+2
-1
No files found.
csrc/cpu/graclus_cpu.cpp
View file @
27387388
...
...
@@ -47,7 +47,7 @@ torch::Tensor graclus_cpu(torch::Tensor rowptr, torch::Tensor col,
}
else
{
auto
weight
=
optional_weight
.
value
();
auto
scalar_type
=
weight
.
scalar_type
();
AT_DISPATCH_ALL_TYPES_AND
(
at
::
ScalarType
::
Half
,
scalar_type
,
"
_
"
,
[
&
]
{
AT_DISPATCH_ALL_TYPES_AND
2
(
at
::
ScalarType
::
Half
,
at
::
ScalarType
::
BFloat16
,
scalar_type
,
"
graclus_cpu
"
,
[
&
]
{
auto
weight_data
=
weight
.
data_ptr
<
scalar_t
>
();
for
(
auto
n
=
0
;
n
<
num_nodes
;
n
++
)
{
...
...
csrc/cpu/knn_cpu.cpp
View file @
27387388
...
...
@@ -25,7 +25,7 @@ torch::Tensor knn_cpu(torch::Tensor x, torch::Tensor y,
std
::
vector
<
size_t
>
out_vec
=
std
::
vector
<
size_t
>
();
AT_DISPATCH_ALL_TYPES_AND
(
at
::
ScalarType
::
Half
,
x
.
scalar_type
(),
"
_
"
,
[
&
]
{
AT_DISPATCH_ALL_TYPES_AND
2
(
at
::
ScalarType
::
Half
,
at
::
ScalarType
::
BFloat16
,
x
.
scalar_type
(),
"
knn_cpu
"
,
[
&
]
{
// See: nanoflann/examples/vector_of_vectors_example.cpp
auto
x_data
=
x
.
data_ptr
<
scalar_t
>
();
...
...
csrc/cpu/radius_cpu.cpp
View file @
27387388
...
...
@@ -25,7 +25,7 @@ torch::Tensor radius_cpu(torch::Tensor x, torch::Tensor y,
std
::
vector
<
size_t
>
out_vec
=
std
::
vector
<
size_t
>
();
AT_DISPATCH_ALL_TYPES_AND
(
at
::
ScalarType
::
Half
,
x
.
scalar_type
(),
"
_
"
,
[
&
]
{
AT_DISPATCH_ALL_TYPES_AND
2
(
at
::
ScalarType
::
Half
,
at
::
ScalarType
::
BFloat16
,
x
.
scalar_type
(),
"
radius_cpu
"
,
[
&
]
{
// See: nanoflann/examples/vector_of_vectors_example.cpp
auto
x_data
=
x
.
data_ptr
<
scalar_t
>
();
...
...
test/utils.py
View file @
27387388
import
torch
dtypes
=
[
torch
.
half
,
torch
.
float
,
torch
.
double
,
torch
.
int
,
torch
.
long
]
dtypes
=
[
torch
.
half
,
torch
.
bfloat16
,
torch
.
float
,
torch
.
double
,
torch
.
int
,
torch
.
long
]
grad_dtypes
=
[
torch
.
half
,
torch
.
float
,
torch
.
double
]
devices
=
[
torch
.
device
(
'cpu'
)]
...
...
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