Any one who can tell me why the speed is different of this two prediction code?


#1

Code 1:


Code 2:

The speed of code 2 is faster than code 1, also, the memory is lower than code 1 too, who can tell me the reason, thanks!!!


#2

hi what do you mean by speed here? do you mean the speed of running each of the code snippets that you provided above? or do you mean speed of running a forward pass on each model?