Commit 01075e1
Fix dropout scale construction for fixed-point types
scale() previously did static_cast<ValueType>(double), which for QValue
invokes the raw-bits constructor — so a 50% dropout on Q8.8 produced a
scale of ~0.008 (raw=2) instead of 2.0 (raw=512), silently corrupting
all fixed-point training runs that used dropout.
Construct the scale from integers via a SFINAE-dispatched fromInteger
helper: cast for floating-point types, (FixedPart, FractionalPart)
constructor for QValue. The forward/backward logic is unchanged.
Restored the fixed-point dropout training tests removed in the previous
commit; they now pass and pin down the corrected behavior.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent f2da5b4 commit 01075e1
2 files changed
Lines changed: 61 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
| |||
157 | 158 | | |
158 | 159 | | |
159 | 160 | | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
160 | 179 | | |
161 | 180 | | |
162 | 181 | | |
163 | 182 | | |
164 | | - | |
| 183 | + | |
| 184 | + | |
165 | 185 | | |
166 | 186 | | |
167 | 187 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4594 | 4594 | | |
4595 | 4595 | | |
4596 | 4596 | | |
| 4597 | + | |
| 4598 | + | |
| 4599 | + | |
| 4600 | + | |
| 4601 | + | |
| 4602 | + | |
| 4603 | + | |
| 4604 | + | |
| 4605 | + | |
| 4606 | + | |
| 4607 | + | |
| 4608 | + | |
| 4609 | + | |
| 4610 | + | |
| 4611 | + | |
| 4612 | + | |
| 4613 | + | |
| 4614 | + | |
| 4615 | + | |
| 4616 | + | |
| 4617 | + | |
| 4618 | + | |
| 4619 | + | |
| 4620 | + | |
| 4621 | + | |
| 4622 | + | |
| 4623 | + | |
| 4624 | + | |
| 4625 | + | |
4597 | 4626 | | |
4598 | 4627 | | |
4599 | 4628 | | |
4600 | | - | |
4601 | | - | |
| 4629 | + | |
| 4630 | + | |
4602 | 4631 | | |
4603 | | - | |
| 4632 | + | |
4604 | 4633 | | |
4605 | 4634 | | |
4606 | | - | |
| 4635 | + | |
4607 | 4636 | | |
4608 | 4637 | | |
4609 | | - | |
| 4638 | + | |
4610 | 4639 | | |
4611 | | - | |
| 4640 | + | |
4612 | 4641 | | |
4613 | 4642 | | |
| 4643 | + | |
4614 | 4644 | | |
4615 | 4645 | | |
4616 | 4646 | | |
4617 | 4647 | | |
4618 | 4648 | | |
4619 | | - | |
| 4649 | + | |
| 4650 | + | |
| 4651 | + | |
4620 | 4652 | | |
4621 | 4653 | | |
4622 | 4654 | | |
4623 | | - | |
| 4655 | + | |
4624 | 4656 | | |
4625 | 4657 | | |
4626 | 4658 | | |
| |||
0 commit comments