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
e89d468b
Commit
e89d468b
authored
Nov 20, 2015
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added log1pexp()
parent
5e92f10f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
0 deletions
+27
-0
core.h
dlib/dnn/core.h
+18
-0
core_abstract.h
dlib/dnn/core_abstract.h
+9
-0
No files found.
dlib/dnn/core.h
View file @
e89d468b
...
...
@@ -14,11 +14,29 @@
#include "../algs.h"
#include <utility>
#include <tuple>
#include <cmath>
namespace
dlib
{
// ----------------------------------------------------------------------------------------
inline
double
log1pexp
(
double
x
)
{
using
std
::
exp
;
using
namespace
std
;
// Do this instead of using std::log1p because some compilers
// error out otherwise (E.g. gcc 4.9 in cygwin)
if
(
x
<=
-
37
)
return
exp
(
x
);
else
if
(
-
37
<
x
&&
x
<=
18
)
return
log1p
(
exp
(
x
));
else
if
(
18
<
x
&&
x
<=
33
.
3
)
return
x
+
exp
(
-
x
);
else
return
x
;
}
// ----------------------------------------------------------------------------------------
// Tell us if T is one of the special layer types (i.e. add_layer, add_tag_layer, or
...
...
dlib/dnn/core_abstract.h
View file @
e89d468b
...
...
@@ -45,6 +45,15 @@ namespace dlib
So it basically returns make_tuple(get<1>(item),get<2>(item),get<3>(item), and so on).
!*/
double
log1pexp
(
double
x
);
/*!
ensures
- returns log(1+exp(x))
(except computes it using a numerically accurate method)
!*/
// ----------------------------------------------------------------------------------------
template
<
...
...
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