Last active
February 28, 2018 14:05
-
-
Save jamesonthecrow/de2f4b8b50db8ffe7df49456a8b8fade to your computer and use it in GitHub Desktop.
Benchmarking neural networks in python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def time_func(function, func_args=None, func_kwargs=None): | |
"""Time a single call of a function. | |
Args: | |
function (function): a function object to time | |
func_args (list, optional): the args for the function | |
func_kwargs (dict, optional): the kwargs for the function | |
Returns: | |
double: duration of the function call in sections | |
""" | |
args = func_args or [] | |
kwargs = func_kwargs or {} | |
start_time = time.time() | |
function(*args, **kwargs) | |
duration = time.time() — start_time | |
return duration |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment