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-scatter
Commits
6d2704b2
"llm/git@developer.sourcefind.cn:OpenDAS/ollama.git" did not exist on "a64570dcae17794adf100a85667180e03b6d7ef2"
Commit
6d2704b2
authored
Feb 11, 2020
by
rusty1s
Browse files
clean up
parent
bcf3a398
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
18 deletions
+16
-18
csrc/scatter.cpp
csrc/scatter.cpp
+16
-18
No files found.
csrc/scatter.cpp
View file @
6d2704b2
#include <Python.h>
#include <torch/script.h>
#include "cpu/scatter_cpu.h"
#include "utils.h"
//
#include "cpu/scatter_cpu.h"
//
#include "utils.h"
#ifdef WITH_CUDA
#include "cuda/scatter_cuda.h"
#endif
// #ifdef WITH_CUDA
// #include <cuda.h>
// #include "cuda/scatter_cuda.h"
// #endif
#ifdef _WIN32
#if PY_MAJOR_VERSION < 3
PyMODINIT_FUNC
init_C
(
void
)
{
return
NULL
;
}
#else
PyMODINIT_FUNC
PyInit__C
(
void
)
{
return
NULL
;
}
#endif
#endif
std
::
tuple
<
torch
::
Tensor
,
torch
::
optional
<
torch
::
Tensor
>>
scatter_fw
(
torch
::
Tensor
src
,
torch
::
Tensor
index
,
int64_t
dim
,
torch
::
optional
<
torch
::
Tensor
>
optional_out
,
torch
::
optional
<
int64_t
>
dim_size
,
std
::
string
reduce
)
{
if
(
src
.
device
().
is_cuda
())
{
#ifdef WITH_CUDA
return
scatter_cuda
(
src
,
index
,
dim
,
optional_out
,
dim_size
,
reduce
);
#else
AT_ERROR
(
"Not compiled with CUDA support"
);
#endif
}
else
{
return
scatter_cpu
(
src
,
index
,
dim
,
optional_out
,
dim_size
,
reduce
);
}
return
std
::
make_tuple
(
src
,
optional_out
);
// if (src.device().is_cuda()) {
// #ifdef WITH_CUDA
// return scatter_cuda(src, index, dim, optional_out, dim_size, reduce);
// #else
// AT_ERROR("Not compiled with CUDA support");
// #endif
// } else {
// return scatter_cpu(src, index, dim, optional_out, dim_size, reduce);
// }
}
static
auto
registry
=
...
...
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