Skip to content

Instantly share code, notes, and snippets.

@mirceast
Created May 22, 2019 13:39
Show Gist options
  • Save mirceast/856c8d77460b099a0a80437e4a33a99e to your computer and use it in GitHub Desktop.
Save mirceast/856c8d77460b099a0a80437e4a33a99e to your computer and use it in GitHub Desktop.
Benchmarking inference performance
import time
fps = np.zeros(200)
with torch.no_grad(): # speed it up by not computing gradients since we don't need them for inference
for i in range(200):
t0 = time.time()
out = model(image)
fps[i] = 1 / (time.time() - t0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment