19 #ifndef TESSERACT_LSTM_WEIGHTMATRIX_H_ 20 #define TESSERACT_LSTM_WEIGHTMATRIX_H_ 42 for (
int i = 0; i < size1; ++i)
put(i, t, data[i]);
46 for (
int i = 0; i < size1; ++i)
put(i, t, data[i]);
50 int num_features =
dim1();
52 for (
int y = 0; y < num_features; ++y) {
53 for (
int t = 0; t < width; ++t) {
54 if (num == 0 || t < num || t + num >= width) {
94 if (multiplier_ ==
nullptr)
return size;
95 return multiplier_->RoundInputs(size);
104 const double*
GetWeights(
int index)
const {
return wf_[index]; }
106 double GetDW(
int i,
int j)
const {
return dw_(i, j); }
143 void Update(
double learning_rate,
double momentum,
double adam_beta,
151 double* changed)
const;
156 static double DotProduct(
const double* u,
const double* v,
int n);
170 bool add_bias_fwd,
bool skip_bias_back,
171 const double* u,
double* v);
194 std::unique_ptr<IntSimdMatrix> multiplier_;
199 #endif // TESSERACT_LSTM_WEIGHTMATRIX_H_ int RoundInputs(int size) const
void Transpose(const GENERIC_2D_ARRAY< double > &input)
void PrintUnTransposed(int num)
static double DotProduct(const double *u, const double *v, int n)
void CountAlternators(const WeightMatrix &other, double *same, double *changed) const
int RemapOutputs(const std::vector< int > &code_map)
void VectorDotMatrix(const double *u, double *v) const
void Update(double learning_rate, double momentum, double adam_beta, int num_samples)
bool Serialize(bool training, TFile *fp) const
virtual ~TransposedArray()
int InitWeightsFloat(int no, int ni, bool use_adam, float weight_range, TRand *randomizer)
void Debug2D(const char *msg)
void MultiplyAccumulate(const double *v, double *inout)
DLLSYM void tprintf(const char *format,...)
void put(ICOORD pos, const double &thing)
void MatrixDotVector(const double *u, double *v) const
void WriteStrided(int t, const double *data)
bool DeSerializeOld(bool training, TFile *fp)
bool DeSerialize(bool training, TFile *fp)
void AddDeltas(const WeightMatrix &other)
const double * GetWeights(int index) const
void WriteStrided(int t, const float *data)
double GetDW(int i, int j) const
static void FloatToDouble(const GENERIC_2D_ARRAY< float > &wf, GENERIC_2D_ARRAY< double > *wd)
void SumOuterTransposed(const TransposedArray &u, const TransposedArray &v, bool parallel)