Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
D
dlib
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
钟尚武
dlib
Commits
5bc1792d
Commit
5bc1792d
authored
May 31, 2017
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added a .fill() member to curand_generator that can create random 32bit
integers.
parent
2ee10362
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
0 deletions
+20
-0
curand_dlibapi.cpp
dlib/dnn/curand_dlibapi.cpp
+11
-0
curand_dlibapi.h
dlib/dnn/curand_dlibapi.h
+9
-0
No files found.
dlib/dnn/curand_dlibapi.cpp
View file @
5bc1792d
...
@@ -91,6 +91,17 @@ namespace dlib
...
@@ -91,6 +91,17 @@ namespace dlib
CHECK_CURAND
(
curandGenerateUniform
((
curandGenerator_t
)
handle
,
data
.
device
(),
data
.
size
()));
CHECK_CURAND
(
curandGenerateUniform
((
curandGenerator_t
)
handle
,
data
.
device
(),
data
.
size
()));
}
}
void
curand_generator
::
fill
(
cuda_data_ptr
<
unsigned
int
>&
data
)
{
if
(
data
.
size
()
==
0
)
return
;
CHECK_CURAND
(
curandGenerate
((
curandGenerator_t
)
handle
,
data
,
data
.
size
()));
}
// -----------------------------------------------------------------------------------
// -----------------------------------------------------------------------------------
}
}
...
...
dlib/dnn/curand_dlibapi.h
View file @
5bc1792d
...
@@ -7,6 +7,7 @@
...
@@ -7,6 +7,7 @@
#include "tensor.h"
#include "tensor.h"
#include "cuda_errors.h"
#include "cuda_errors.h"
#include "cuda_data_ptr.h"
namespace
dlib
namespace
dlib
{
{
...
@@ -26,6 +27,14 @@ namespace dlib
...
@@ -26,6 +27,14 @@ namespace dlib
curand_generator
(
unsigned
long
long
seed
);
curand_generator
(
unsigned
long
long
seed
);
~
curand_generator
();
~
curand_generator
();
void
fill
(
cuda_data_ptr
<
unsigned
int
>&
data
);
/*!
ensures
- Fills data with random 32-bit unsigned integers.
!*/
void
fill_gaussian
(
void
fill_gaussian
(
tensor
&
data
,
tensor
&
data
,
float
mean
=
0
,
float
mean
=
0
,
...
...
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