| 110 pub fn if_merge_now<I: AlgIterator, A>( |
110 pub fn if_merge_now<I: AlgIterator, A>( |
| 111 &self, |
111 &self, |
| 112 state: &AlgIteratorIteration<I>, |
112 state: &AlgIteratorIteration<I>, |
| 113 mut f: impl FnMut(&Self) -> DynResult<A>, |
113 mut f: impl FnMut(&Self) -> DynResult<A>, |
| 114 ) -> DynResult<Option<A>> { |
114 ) -> DynResult<Option<A>> { |
| 115 if (self.merging.enabled || self.merging.scaling.is_some()) |
115 if (self.merging.enabled |
| |
116 || self.merging.scaling.is_some() |
| |
117 || self.extra_weight_optimisation_steps > 0) |
| 116 && state.iteration() % self.merge_every == 0 |
118 && state.iteration() % self.merge_every == 0 |
| 117 { |
119 { |
| 118 if self.max_scaling_iter != 0 && state.iteration() > self.max_scaling_iter { |
120 if self.max_scaling_iter != 0 && state.iteration() > self.max_scaling_iter { |
| 119 if !self.merging.enabled { |
121 if !self.merging.enabled { |
| 120 Ok(None) |
122 Ok(None) |
| 136 pub fn if_merge_now_check<I: AlgIterator, A>( |
138 pub fn if_merge_now_check<I: AlgIterator, A>( |
| 137 &self, |
139 &self, |
| 138 state: &AlgIteratorIteration<I>, |
140 state: &AlgIteratorIteration<I>, |
| 139 mut f: impl FnMut() -> A, |
141 mut f: impl FnMut() -> A, |
| 140 ) -> Option<A> { |
142 ) -> Option<A> { |
| 141 if (self.merging.enabled || self.merging.scaling.is_some()) |
143 if (self.merging.enabled |
| |
144 || self.merging.scaling.is_some() |
| |
145 || self.extra_weight_optimisation_steps > 0) |
| 142 && state.iteration() % self.merge_every == 0 |
146 && state.iteration() % self.merge_every == 0 |
| 143 { |
147 { |
| 144 if self.max_scaling_iter != 0 && state.iteration() > self.max_scaling_iter { |
148 if self.max_scaling_iter != 0 && state.iteration() > self.max_scaling_iter { |
| 145 if !self.merging.enabled { |
149 if !self.merging.enabled { |
| 146 None |
150 None |