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
cb2f9de6
Commit
cb2f9de6
authored
Nov 09, 2015
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added part of the tensor_tools implementations
parent
76433858
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
74 additions
and
13 deletions
+74
-13
CMakeLists.txt
dlib/CMakeLists.txt
+1
-0
source.cpp
dlib/all/source.cpp
+1
-0
dnn.h
dlib/dnn.h
+1
-0
cpu_dlib.h
dlib/dnn/cpu_dlib.h
+3
-0
tensor_tools.cpp
dlib/dnn/tensor_tools.cpp
+0
-0
tensor_tools.h
dlib/dnn/tensor_tools.h
+68
-13
No files found.
dlib/CMakeLists.txt
View file @
cb2f9de6
...
@@ -138,6 +138,7 @@ if (NOT TARGET dlib)
...
@@ -138,6 +138,7 @@ if (NOT TARGET dlib)
if
(
COMPILER_CAN_DO_CPP_11
)
if
(
COMPILER_CAN_DO_CPP_11
)
set
(
source_files
${
source_files
}
set
(
source_files
${
source_files
}
dnn/cpu_dlib.cpp
dnn/cpu_dlib.cpp
dnn/tensor_tools.cpp
)
)
endif
()
endif
()
...
...
dlib/all/source.cpp
View file @
cb2f9de6
...
@@ -21,6 +21,7 @@
...
@@ -21,6 +21,7 @@
// Stuff that requires C++11
// Stuff that requires C++11
#if __cplusplus >= 201103
#if __cplusplus >= 201103
#include "../dnn/cpu_dlib.cpp"
#include "../dnn/cpu_dlib.cpp"
#include "../dnn/tensor_tools.cpp"
#endif
#endif
#ifndef DLIB_ISO_CPP_ONLY
#ifndef DLIB_ISO_CPP_ONLY
...
...
dlib/dnn.h
View file @
cb2f9de6
...
@@ -11,6 +11,7 @@
...
@@ -11,6 +11,7 @@
#include "dnn/solvers.h"
#include "dnn/solvers.h"
#include "dnn/trainer.h"
#include "dnn/trainer.h"
#include "dnn/cpu_dlib.h"
#include "dnn/cpu_dlib.h"
#include "dnn/tensor_tools.h"
#endif // DLIB_DNn_
#endif // DLIB_DNn_
...
...
dlib/dnn/cpu_dlib.h
View file @
cb2f9de6
...
@@ -91,6 +91,9 @@ namespace dlib
...
@@ -91,6 +91,9 @@ namespace dlib
}
}
}
}
#ifdef NO_MAKEFILE
#include "cpu_dlib.cpp"
#endif
#endif // DLIB_DNN_CPU_H_
#endif // DLIB_DNN_CPU_H_
...
...
dlib/dnn/tensor_tools.cpp
0 → 100644
View file @
cb2f9de6
This diff is collapsed.
Click to expand it.
dlib/dnn/tensor_tools.h
View file @
cb2f9de6
...
@@ -4,8 +4,12 @@
...
@@ -4,8 +4,12 @@
#define DLIB_TeNSOR_TOOLS_H_
#define DLIB_TeNSOR_TOOLS_H_
#include "tensor.h"
#include "tensor.h"
#include "cudnn_dlibapi.h"
#include "cublas_dlibapi.h"
#include "curand_dlibapi.h"
#include "../rand.h"
namespace
dlib
namespace
dlib
{
namespace
tt
{
{
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
...
@@ -37,7 +41,51 @@ namespace dlib
...
@@ -37,7 +41,51 @@ namespace dlib
class
tensor_rand
class
tensor_rand
{
{
/*!
WHAT THIS OBJECT REPRESENTS
This is a tool for filling a tensor with random numbers.
Note that the sequence of random numbers output by this object is different
when dlib is compiled with DLIB_USE_CUDA. So you should not write code
that depends on any specific sequence of numbers coming out of a
tensor_rand.
!*/
public
:
public
:
// not copyable
tensor_rand
(
const
tensor_rand
&
)
=
delete
;
tensor_rand
&
operator
=
(
const
tensor_rand
&
)
=
delete
;
tensor_rand
()
:
tensor_rand
(
0
)
{}
tensor_rand
(
unsigned
long
long
seed
);
void
fill_gaussian
(
tensor
&
data
,
float
mean
,
float
stddev
);
/*!
requires
- data.size()%2 == 0
ensures
- Fills data with random numbers drawn from a Gaussian distribution
with the given mean and standard deviation.
!*/
void
fill_uniform
(
tensor
&
data
);
/*!
ensures
- Fills data with uniform random numbers in the range (0.0, 1.0].
!*/
#ifdef DLIB_USE_CUDA
cuda
::
curand_generator
rnd
;
#else
dlib
::
rand
rnd
;
#endif
};
};
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
...
@@ -278,13 +326,13 @@ namespace dlib
...
@@ -278,13 +326,13 @@ namespace dlib
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
class
conv
class
tensor_
conv
{
{
public
:
public
:
conv
(
const
conv
&
)
=
delete
;
tensor_conv
(
const
tensor_
conv
&
)
=
delete
;
conv
&
operator
=
(
const
conv
&
)
=
delete
;
tensor_conv
&
operator
=
(
const
tensor_
conv
&
)
=
delete
;
conv
();
tensor_
conv
();
void
clear
(
void
clear
(
);
);
...
@@ -302,9 +350,6 @@ namespace dlib
...
@@ -302,9 +350,6 @@ namespace dlib
- stride_x > 0
- stride_x > 0
!*/
!*/
~
conv
(
);
void
operator
()
(
void
operator
()
(
resizable_tensor
&
output
,
resizable_tensor
&
output
,
const
tensor
&
data
,
const
tensor
&
data
,
...
@@ -362,6 +407,11 @@ namespace dlib
...
@@ -362,6 +407,11 @@ namespace dlib
!*/
!*/
private
:
private
:
#ifdef DLIB_USE_CUDA
cuda
::
tensor_conv
impl
;
#else
// TODO
#endif
};
};
...
@@ -379,9 +429,6 @@ namespace dlib
...
@@ -379,9 +429,6 @@ namespace dlib
max_pool
(
max_pool
(
);
);
~
max_pool
(
);
void
clear
(
void
clear
(
);
);
...
@@ -429,6 +476,11 @@ namespace dlib
...
@@ -429,6 +476,11 @@ namespace dlib
!*/
!*/
private
:
private
:
#ifdef DLIB_USE_CUDA
cuda
::
max_pool
impl
;
#else
// TODO
#endif
};
};
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
...
@@ -564,8 +616,11 @@ namespace dlib
...
@@ -564,8 +616,11 @@ namespace dlib
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
}
}}
}
#ifdef NO_MAKEFILE
#include "tensor_tools.cpp"
#endif
#endif // DLIB_TeNSOR_TOOLS_H_
#endif // DLIB_TeNSOR_TOOLS_H_
...
...
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