def threading_data(data=None, fn=None, **kwargs):
 def apply_fn(results, i, data, kwargs):
  results[i] = fn(data, **kwargs)
 results = ([None] * len(data))
 threads = []
 for i in range(len(data)):
  t = threading.Thread(name='threading_and_return', target=apply_fn, args=(results, i, data[i], kwargs))
  t.start()
  threads.append(t)
 for t in threads:
  t.join()
 return np.asarray(results)

def threading_data ( data = None , fn = None , ** kwargs ) : def apply_fn ( results , i , data , kwargs ) : results [ i ] = fn ( data , ** kwargs ) results = ( [ None ] * len ( data ) ) threads = [ ] for i in range ( len ( data ) ) : t = threading . Thread ( name = 'threading_and_return' , target = apply_fn , args = ( results , i , data [ i ] , kwargs ) ) t . start ( ) threads . append ( t ) for t in threads : t . join ( ) return np . asarray ( results )
return a batch of result by given data .