Skip to content

Instantly share code, notes, and snippets.

@cjauvin
Created September 13, 2014 20:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cjauvin/9bd1b6044fc703486c0c to your computer and use it in GitHub Desktop.
Save cjauvin/9bd1b6044fc703486c0c to your computer and use it in GitHub Desktop.
from joblib import Parallel, delayed
import numpy as np
N = 1000
def big_fucking_computation(dir):
# do something with dir..
# this should take some time..
return np.random.random((784, N))
res = Parallel(n_jobs=-1)(delayed(big_fucking_computation)(dir)
for dir in ['top', 'down', 'left', 'right'])
augmented = np.hstack(res)
print(augmented.shape) # (784, 4000)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment