Answers for "parallel loops in python"

0

parallel loops in python

pythonCopyfrom joblib import Parallel, delayed
import math

def sqrt_func(i, j):
    time.sleep(1)
    return math.sqrt(i**j)

Parallel(n_jobs=2)(delayed(sqrt_func)(i, j) for i in range(5) for j in range(2))
Posted by: Guest on August-24-2021

Python Answers by Framework

Browse Popular Code Answers by Language