示例#1
0
 def reduce_wrapper(seq, init=None):
     # Numba's CUDA reduce allows an empty sequence to be reduced with no
     # initializer but functools.reduce does not.
     if len(seq) == 0 and init == None:
         init = 0
     if init is not None:
         return pyreduce(func, seq, init)
     else:
         return pyreduce(func, seq)
示例#2
0
 def reduce_wrapper(seq, res=None, init=0):
     r = pyreduce(func, seq, init)
     if res is not None:
         res[0] = r
         return None
     else:
         return r
示例#3
0
 def reduce_wrapper(seq, res=None, init=0):
     r = pyreduce(func, seq, init)
     if res is not None:
         res[0] = r
         return None
     else:
         return r