make weights loading more robust by using bounds-checked accessor#35
make weights loading more robust by using bounds-checked accessor#35fps wants to merge 1 commit intomikeoliphant:mainfrom
Conversation
|
Doing .at() for each weight is likely adding overhead. Might not be significant, but I think it makes more sense to do manual bounds checking on blocks. |
|
Yes, the bounds checks add overhead, but even if it's 100 times slower, it doesn't really matter when the number of weights is 13000 or so. Maybe it will take 1 ms instead of 10 us on a core 2 duo class cpu ;) And the weights loading is not in the time critical DSP path anyways. |
|
Model load performance can be a consideration on very low powered machines, but it is more of a matter of principle than anything else. Why check bounds 100s of times when you can do it once? Plus, you can then throw a more informative error than a generic vector bounds exception. |
|
OK! We'll have to agree to disagree then. |
|
Addressed via 14fb7bf |
.at()has the property of being bounds-checked and that an exception is thrown in the out-of-bounds case.