I’m very very thankful of your reply.
But I cannot find out which part of the code takes so much time.
one 128 batch of my data in your takes 1.5 seconds but in my code takes 1 hour.
Is it because of the initialization of the network?
model=ResidualLearningNet()
model.apply(weights_init)
model.to(device)
optimizer=torch.optim.SGD(model.parameters(),lr=0.000001)
criterion=nn.MSELoss()

I wrote the code in google colab. If it helps, I can send you the link of my code.