Last active
September 16, 2017 04:52
-
-
Save santisy/40842eaf393356013fe60d30267007c0 to your computer and use it in GitHub Desktop.
minimum example of strange speed change
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
import torch | |
import time | |
import numpy as np | |
time1 = time.time() | |
## double this tensor's second dimension(20->40), you will almost double the time | |
for _ in range(100): | |
tensor = torch.randn(5, 20, 128, 128) | |
array = np.zeros((128, 128), dtype=np.uint8) | |
tensor[1, 2, :, :] = torch.from_numpy(array).float() | |
time2 = time.time() | |
print "time past: %.4f" %((time2-time1)/100) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment