tfep.utils.parallel.ParallelizationStrategy
- class tfep.utils.parallel.ParallelizationStrategy[source]
Bases:
ABCThe API of a ParallelizationStrategy object.
To implement a new parallelization strategy compatible with the
tfeplibrary, the object must implement therunmethod, which encapsulate the parallelization of a function over the arguments to distribute.- __init__()
Methods
__init__()run(func, args)Parallelize the function over the arguments.
- abstract run(func, args)[source]
Parallelize the function over the arguments.
- Parameters:
func (Callable) – The function to parallelize over the arguments.
args (Iterable) – The arguments to distribute across parallel executions of the function.
args[i]are the arguments of thei-th execution, and they are passed to the function asfunc(*args[i]).
- Returns:
results –
results[i]is the return value of the function called withargs[i].- Return type:
List