Thanks for your answer，I try to take
(3). for i in range(0,batch_size):
x=x+1
and I found (2) still took much more time than (3). Is there any difference between the computation graph they create? It seems that (2) is an in-place operation, does the result is related to this?