holocron.utils¶
holocron.utils provides some utilities for general usage.
Miscellaneous¶
parallel
¶
parallel(func: Callable[[Inp], Out], arr: Sequence[Inp], num_threads: int | None = None, progress: bool = False, **kwargs: Any) -> Iterable[Out]
Performs parallel tasks by leveraging multi-threading.
| PARAMETER | DESCRIPTION |
|---|---|
func
|
function to be executed on multiple workers
TYPE:
|
arr
|
function argument's values
TYPE:
|
num_threads
|
number of workers to be used for multiprocessing
TYPE:
|
progress
|
whether the progress bar should be displayed
TYPE:
|
kwargs
|
keyword arguments of [
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Iterable[Out]
|
list of function's results |
Source code in holocron/utils/misc.py
find_image_size
¶
Computes the best image size target for a given set of images
| PARAMETER | DESCRIPTION |
|---|---|
dataset
|
an iterator yielding a |
**kwargs
|
keyword args of
TYPE:
|