19 #ifndef TESSERACT_LSTM_WEIGHTMATRIX_H_ 20 #define TESSERACT_LSTM_WEIGHTMATRIX_H_ 39 for (
int i = 0; i < size1; ++i)
put(i, t, data[i]);
43 for (
int i = 0; i < size1; ++i)
put(i, t, data[i]);
47 int num_features =
dim1();
49 for (
int y = 0; y < num_features; ++y) {
50 for (
int t = 0; t < width; ++t) {
51 if (num == 0 || t < num || t + num >= width) {
71 int InitWeightsFloat(
int no,
int ni,
bool ada_grad,
float weight_range,
87 int NumOutputs()
const {
return int_mode_ ? wi_.dim1() : wf_.dim1(); }
91 double GetDW(
int i,
int j)
const {
return dw_(i, j); }
103 bool DeSerializeOld(
bool training,
TFile* fp);
110 void MatrixDotVector(
const double*
u,
double*
v)
const;
111 void MatrixDotVector(
const inT8* u,
double* v)
const;
119 void VectorDotMatrix(
const double* u,
double* v)
const;
129 void Update(
double learning_rate,
double momentum,
int num_samples);
135 void CountAlternators(
const WeightMatrix& other,
double* same,
136 double* changed)
const;
138 void Debug2D(
const char* msg);
141 static double DotProduct(
const double* u,
const double* v,
int n);
155 bool add_bias_fwd,
bool skip_bias_back,
156 const double* u,
double* v);
182 #endif // TESSERACT_LSTM_WEIGHTMATRIX_H_
double GetDW(int i, int j) const
void MultiplyAccumulate(int n, const double *u, const double *v, double *out)
void Transpose(const GENERIC_2D_ARRAY< double > &input)
void WriteStrided(int t, const float *data)
void WriteStrided(int t, const double *data)
const double * GetWeights(int index) const
bool Serialize(FILE *fp) const
bool DeSerialize(bool swap, FILE *fp)
virtual int index(int column, int row) const
void put(ICOORD pos, const double &thing)
double DotProduct(const double *u, const double *v, int n)
void PrintUnTransposed(int num)