okay,thank you.Concerning the speed,i have one more question:
class net(nn.Module):
    def __init__(self):
        super(net,self).__init__()
        self.linear=nn.Linear(2,2)
    def forward(self,x):
        for i in range(2):
            x=self.linear(x)
        return x

in the above code for i in range(2),the loop is controlled by cpu or gpu?if cpu,for the sake of  speed,should i use the following way?i wonder if there is a special controller in GPU to do some easy control,so cpu can be free of computation in most time rather than control gpu all the time?
def forward(self,x):
    x=self.linear(x)
    x=self.linear(x)
    return x