Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(858)

Unified Diff: src/mlp_train.h

Issue 882843002: Update to opus-HEAD-66611f1. (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/opus.git@master
Patch Set: Add the contents of Makefile.mips back. Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/mlp_data.c ('k') | src/mlp_train.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/mlp_train.h
diff --git a/src/mlp_train.h b/src/mlp_train.h
index 1857f64449bf2bb5770bc56885febf7a5d942075..2786b40d8ba07ee41014bdc470e96bcb8fddf55a 100644
--- a/src/mlp_train.h
+++ b/src/mlp_train.h
@@ -32,31 +32,31 @@
#include <stdlib.h>
double tansig_table[501];
-static inline double tansig_double(double x)
+static inline double tansig_double(double x)
{
- return 2./(1.+exp(-2.*x)) - 1.;
+ return 2./(1.+exp(-2.*x)) - 1.;
}
static inline void build_tansig_table()
{
- int i;
- for (i=0;i<501;i++)
- tansig_table[i] = tansig_double(.04*(i-250));
+ int i;
+ for (i=0;i<501;i++)
+ tansig_table[i] = tansig_double(.04*(i-250));
}
static inline double tansig_approx(double x)
{
- int i;
- double y, dy;
- if (x>=10)
- return 1;
- if (x<=-10)
- return -1;
- i = lrint(25*x);
- x -= .04*i;
- y = tansig_table[250+i];
- dy = 1-y*y;
- y = y + x*dy*(1 - y*x);
- return y;
+ int i;
+ double y, dy;
+ if (x>=10)
+ return 1;
+ if (x<=-10)
+ return -1;
+ i = lrint(25*x);
+ x -= .04*i;
+ y = tansig_table[250+i];
+ dy = 1-y*y;
+ y = y + x*dy*(1 - y*x);
+ return y;
}
inline float randn(float sd)
@@ -75,11 +75,11 @@ inline float randn(float sd)
typedef struct {
- int layers;
- int *topo;
- double **weights;
- double **best_weights;
- double *in_rate;
+ int layers;
+ int *topo;
+ double **weights;
+ double **best_weights;
+ double *in_rate;
} MLPTrain;
« no previous file with comments | « src/mlp_data.c ('k') | src/mlp_train.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698