Anyone can improve processing time to generate list of sequence number ? Here is my code and it needs ~ 0.05 second.
import torch
import time
import random
index = [torch.tensor(660000)]
st = time.time()
allowed = [x for x in range(index[0])] + [x for x in range(index[0] + 1,2000)]
index = random.sample(allowed, 1000)
print(time.time()-st)
Please advise
thank you