I set up a Net, and test the forward time with the random input:

test_data = torch.randn(1, 500, 3).cuda()
net = Net().cuda()
net.load_state_dict(torch.load(‘Net.pth’))
net.eval()
t1 = time.process_time()
output = net(test_data)
t2 = time.process_time()
print('forward time: ',t2-t1)

and get the forward time:

forward time:  0.0874945260000004

but when I use this model in real-world data in my task, I get a different time:

forward time:  0.3340185280000014

the real-world data has the same shape of my test data, why the forward time are different? and how to reduce the forward time in  real-world task?