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
83faec77
Commit
83faec77
authored
Jul 21, 2021
by
rusty1s
Browse files
fix CPP build
parent
c2350bb6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
csrc/cpu/utils.h
csrc/cpu/utils.h
+5
-5
No files found.
csrc/cpu/utils.h
View file @
83faec77
...
@@ -17,17 +17,17 @@
...
@@ -17,17 +17,17 @@
}()
}()
template
<
typename
scalar_t
>
template
<
typename
scalar_t
>
torch
::
Tensor
from_vector
(
const
std
::
vector
<
scalar_t
>
&
vec
,
inline
torch
::
Tensor
from_vector
(
const
std
::
vector
<
scalar_t
>
&
vec
,
bool
inplace
=
false
)
{
bool
inplace
=
false
)
{
const
auto
size
=
(
int64_t
)
vec
.
size
();
const
auto
size
=
(
int64_t
)
vec
.
size
();
const
auto
out
=
torch
::
from_blob
((
scalar_t
*
)
vec
.
data
(),
{
size
},
const
auto
out
=
torch
::
from_blob
((
scalar_t
*
)
vec
.
data
(),
{
size
},
c10
::
CppTypeToScalarType
<
scalar_t
>::
value
);
c10
::
CppTypeToScalarType
<
scalar_t
>::
value
);
return
inplace
?
out
:
out
.
clone
();
return
inplace
?
out
:
out
.
clone
();
}
}
torch
::
Tensor
choice
(
int64_t
population
,
int64_t
num_samples
,
inline
torch
::
Tensor
bool
replace
=
false
,
choice
(
int64_t
population
,
int64_t
num_samples
,
bool
replace
=
false
,
torch
::
optional
<
torch
::
Tensor
>
weight
=
torch
::
nullopt
)
{
torch
::
optional
<
torch
::
Tensor
>
weight
=
torch
::
nullopt
)
{
if
(
!
replace
&&
num_samples
>=
population
)
if
(
!
replace
&&
num_samples
>=
population
)
return
torch
::
arange
(
population
,
at
::
kLong
);
return
torch
::
arange
(
population
,
at
::
kLong
);
...
...
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