20 #ifndef TESSERACT_LSTM_NETWORKSCRATCH_H_ 21 #define TESSERACT_LSTM_NETWORKSCRATCH_H_ 23 #include "genericvector.h" 25 #include "networkio.h" 89 void Resize2d(
bool int_mode,
int width,
int num_features,
160 operator double*()
const {
return data_; }
161 double*
get() {
return data_; }
189 array_->Resize(size1, size2, 0.0);
216 if (stack_top_ == stack_.size()) {
217 stack_.push_back(
new T);
218 flags_.push_back(
false);
220 flags_[stack_top_] =
true;
221 return stack_[stack_top_++];
231 int index = stack_top_ - 1;
232 while (index >= 0 && stack_[index] != item) --index;
233 if (index >= 0) flags_[index] =
false;
234 while (stack_top_ > 0 && !flags_[stack_top_ - 1]) --stack_top_;
257 #endif // TESSERACT_LSTM_NETWORKSCRATCH_H_ Stack()
Definition: networkscratch.h:209
GenericVector< double > * vec_
Definition: networkscratch.h:165
Definition: networkscratch.h:53
FloatVec()
Definition: networkscratch.h:144
Stack< NetworkIO > int_stack_
Definition: networkscratch.h:249
~NetworkScratch()=default
void Resize(const NetworkIO &src, int num_features, NetworkScratch *scratch)
Definition: networkscratch.h:78
bool int_mode_
Definition: networkscratch.h:246
~FloatVec()
Definition: networkscratch.h:145
Definition: networkscratch.h:36
TransposedArray * array_
Definition: networkscratch.h:198
IO()
Definition: networkscratch.h:64
Definition: baseapi.cpp:94
double * data_
Definition: networkscratch.h:167
Definition: networkscratch.h:207
NetworkScratch * scratch_space_
Definition: networkscratch.h:130
bool int_mode() const
Definition: networkio.h:127
Stack< NetworkIO > float_stack_
Definition: networkscratch.h:250
NetworkScratch()
Definition: networkscratch.h:38
NetworkIO * operator->()
Definition: networkscratch.h:116
Definition: weightmatrix.h:33
GradientStore()
Definition: networkscratch.h:179
void Return(T *item)
Definition: networkscratch.h:228
FloatVec(int size, NetworkScratch *scratch)
Definition: networkscratch.h:139
NetworkScratch * scratch_space_
Definition: networkscratch.h:170
void ResizeFloat(const NetworkIO &src, int num_features, NetworkScratch *scratch)
Definition: networkscratch.h:101
void Init(int size1, int size2, NetworkScratch *scratch)
Definition: networkscratch.h:184
int stack_top_
Definition: networkscratch.h:240
T * Borrow()
Definition: networkscratch.h:214
GenericVector< bool > flags_
Definition: networkscratch.h:239
void ResizeFloat(const NetworkIO &src, int num_features)
Definition: networkio.h:52
void set_int_mode(bool int_mode)
Definition: networkscratch.h:46
void Resize2d(bool int_mode, int width, int num_features)
Definition: networkio.cpp:40
void Resize(const NetworkIO &src, int num_features)
Definition: networkio.h:45
NetworkIO * network_io_
Definition: networkscratch.h:127
bool int_mode_
Definition: networkscratch.h:125
NetworkScratch * scratch_space_
Definition: networkscratch.h:201
Definition: networkscratch.h:136
Definition: genericvector.h:457
PointerVector< T > stack_
Definition: networkscratch.h:238
SVMutex mutex_
Definition: networkscratch.h:241
~IO()
Definition: networkscratch.h:66
void Resize2d(bool int_mode, int width, int num_features, NetworkScratch *scratch)
Definition: networkscratch.h:89
const TransposedArray & operator*() const
Definition: networkscratch.h:194
Definition: networkio.h:39
void Init(int size, NetworkScratch *scratch)
Definition: networkscratch.h:149
Stack< TransposedArray > array_stack_
Definition: networkscratch.h:252
void resize_no_init(int size)
Definition: genericvector.h:65
IO(const NetworkIO &src, NetworkScratch *scratch)
Definition: networkscratch.h:56
Stack< GenericVector< double > > vec_stack_
Definition: networkscratch.h:251
~GradientStore()
Definition: networkscratch.h:180
NetworkIO & operator*()
Definition: networkscratch.h:113
Definition: networkscratch.h:176