Apologies for not being clear. I’m comparing the running speed of the server I’m using with the normal speed of this line of code, where I was assuming that the speed on my MacBook is the “normal speed”. Sorry for that. But I do believe that 0.01s is unusual, probably 10x slower than any other normally-working device. As I said, one day it suddenly need 10x more time to execute my code. But I couldn’t figure out what went wrong.
Thank you for your advice of using timeit. I tried and here are the results:
On my slow server;
>>> timeit.timeit('import torch;torch.where(torch.randint(0,100,(1000,1000)) == 0)', number=100)
18.391881837975234

On my Macbook:
timeit.timeit('import torch;torch.where(torch.randint(0,100,(1000,1000)) == 0)', number=100)
1.2651853299998947