有没有办法让parallel
函数接受多个参数,但只在其中一个参数上并行
假设我有一些代码:
def my_function(graph,graph_coefficients, thing_i_want_to_parallelise_over):
<do_thing>
return value
results = Parallel(n_job2=2)(delayed(my_function(one_graph,graph_coefficients)(thing_i_want_to_parallelise_over) for thing_i_want_to_parallelise_over in range(1,3))
有办法做到这一点吗?有多个函数可以调用,因此执行一个简单的概括函数实际上不是一个选项
我不知道我是否理解您的问题,但您的格式不正确
您应该创建包含所有参数的元组
然后你就应该把它和
像
最终,您可以尝试使用
lambda
然后你可以使用
像
或与
functools.partial
像
最小工作代码
相关问题 更多 >
编程相关推荐