36 int stack_size =
stack_.size();
37 for (
int i = 0; i < stack_size; ++i) {
38 result =
stack_[i]->OutputShape(result);
48 tprintf(
"Num outputs,weights in Series:\n");
49 for (
int i = 0; i <
stack_.size(); ++i) {
50 int weights =
stack_[i]->InitWeights(range, randomizer);
63 tprintf(
"Num (Extended) outputs,weights in Series:\n");
64 for (
int i = 0; i <
stack_.size(); ++i) {
65 int weights =
stack_[i]->RemapOutputs(old_no, code_map);
80 for (
int i = 0; i <
stack_.size(); ++i)
82 return needs_backprop;
93 for (
int i = 0; i <
stack_.size(); ++i)
101 stack_[0]->CacheXScaleFactor(factor);
109 int stack_size =
stack_.size();
116 stack_[0]->Forward(debug, input, input_transpose, scratch, buffer1);
117 for (
int i = 1; i < stack_size; i += 2) {
118 stack_[i]->Forward(debug, *buffer1,
nullptr, scratch,
119 i + 1 < stack_size ? buffer2 : output);
120 if (i + 1 == stack_size)
return;
121 stack_[i + 1]->Forward(debug, *buffer2,
nullptr, scratch,
122 i + 2 < stack_size ? buffer1 : output);
132 int stack_size =
stack_.size();
139 if (!
stack_.back()->IsTraining() ||
140 !
stack_.back()->Backward(debug, fwd_deltas, scratch, buffer1))
142 for (
int i = stack_size - 2; i >= 0; i -= 2) {
144 !
stack_[i]->Backward(debug, *buffer1, scratch,
145 i > 0 ? buffer2 : back_deltas))
149 !
stack_[i - 1]->Backward(debug, *buffer2, scratch,
150 i > 1 ? buffer1 : back_deltas))
162 if (last_start < 0 || last_start >=
stack_.size()) {
163 tprintf(
"Invalid split index %d must be in range [0,%d]!\n",
164 last_start,
stack_.size() - 1);
169 for (
int s = 0; s <= last_start; ++s) {
172 auto* fc = static_cast<FullyConnected*>(
stack_[s]);
178 for (
int s = last_start + 1; s <
stack_.size(); ++s) {
182 *start = master_series;
183 *end = boosted_series;
191 auto* src_series = static_cast<Series*>(src);
192 for (
int s = 0; s < src_series->stack_.size(); ++s) {
194 src_series->stack_[s] =
nullptr;