Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix bug with epsilon composition.
Tests
Running tests...
Test project /Users/awni/repos/gtn/build
Start 1: autograd_test
1/8 Test #1: autograd_test .................... Passed 0.87 sec
Start 2: creations_test
2/8 Test #2: creations_test ................... Passed 0.37 sec
Start 3: criterion_test
3/8 Test #3: criterion_test ................... Passed 0.57 sec
Start 4: functions_test
4/8 Test #4: functions_test ................... Passed 0.86 sec
Start 5: parallel_test
5/8 Test #5: parallel_test .................... Passed 0.81 sec
Start 6: graph_test
6/8 Test #6: graph_test ....................... Passed 0.44 sec
Start 7: utils_test
7/8 Test #7: utils_test ....................... Passed 0.33 sec
Start 8: rand_test
8/8 Test #8: rand_test ........................ Passed 0.50 sec
100% tests passed, 0 tests failed out of 8
Total Test time (real) = 4.74 sec
Benchmarks
TLDR not a huge impact, negligible for CTC.
Before fix
Timing composeForward ... 142.12 msec
Timing composeBackward ... 0.79 msec
Timing composeForwardSorted ... 9.53 msec
Timing ctcLoss ... 124.37 msec
Timing ctcGrad ... 21.44 msec
Timing ngramCtcLoss ... 5.47 msec
Timing ngramCtcGrad ... 0.61 msec
Timing ctcBatched ... 210.01 msec
After fix
Timing composeForward ... 144.14 msec
Timing composeBackward ... 0.8 msec
Timing composeForwardSorted ... 10.19 msec
Timing ctcLoss ... 131.27 msec
Timing ctcGrad ... 21.73 msec
Timing ngramCtcLoss ... 6.19 msec
Timing ngramCtcGrad ... 0.61 msec
Timing ctcBatched ... 218.7 msec