-
Notifications
You must be signed in to change notification settings - Fork 420
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: Moved multithreading to doctr.utils (#371)
* refactor: Moved multithreading to doctr.utils * refactor: Reflected changes on imports * test: Added unittest for multithreading * test: Removed legacy multithreading test * test: Fixed unittest for single threading
- Loading branch information
Showing
4 changed files
with
22 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import pytest | ||
|
||
import numpy as np | ||
from doctr.utils.multithreading import multithread_exec | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"input_seq, func, output_seq", | ||
[ | ||
[[1, 2, 3], lambda x: 2 * x, [2, 4, 6]], | ||
[[1, 2, 3], lambda x: x ** 2, [1, 4, 9]], | ||
[ | ||
['this is', 'show me', 'I know'], | ||
lambda x: x + ' the way', | ||
['this is the way', 'show me the way', 'I know the way'] | ||
], | ||
], | ||
) | ||
def test_multithread_exec(input_seq, func, output_seq): | ||
assert multithread_exec(func, input_seq) == output_seq | ||
assert list(multithread_exec(func, input_seq, 0)) == output_seq |
This file was deleted.
Oops, something went wrong.