Skip to content

Instantly share code, notes, and snippets.

@karanpathak
Last active May 23, 2020 11:25
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 karanpathak/5e82fdfa9a0ac8edcbb7c2926f90ff4e to your computer and use it in GitHub Desktop.
Save karanpathak/5e82fdfa9a0ac8edcbb7c2926f90ff4e to your computer and use it in GitHub Desktop.
# Define our function
def func(x):
print("Example of Computationally intensive function!")
print("The result is not cached for this particular input")
sleep(4.0)
return np.square(x)
# Pass it to Memory.cache method
func_mem = mem.cache(func, verbose=0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment