title: Need to change GPU option to CPU in a python pytorch based code
body: <p>The code basically trains the usual MNIST image dataset but it does the training on a GPU. I need to change this option so the code trains the model using my laptop computer. I need to substitute the <code>.cuda()</code> at the second line for the equivalent in CPU. </p>
  
  <p>I know there are many examples online on how to train neural networks using the MNIST database but what is special about this code is that it does the optimization using a PID controller (commonly used in industry) and I need the code as part of my research. </p>
  
  <pre><code>net = Net(input_size, hidden_size, num_classes)
  net.cuda()                                                                 
  net.train()                                                                
  #Loss and Optimizer
  criterion = nn.CrossEntropyLoss()  
  optimizer = PIDOptimizer(net.parameters(), lr=learning_rate, weight_decay=0.0001, momentum=0.9, I=I, D=D)
  # Train the Model
  for epoch in range(num_epochs):
      train_loss_log = AverageMeter()
      train_acc_log = AverageMeter()
      val_loss_log = AverageMeter()
      val_acc_log = AverageMeter()    
      for i, (images, labels) in enumerate(train_loader):  
          # Convert torch tensor to Variable
          images = Variable(images.view(-1, 28*28).cuda())
          labels = Variable(labels.cuda())
  </code></pre>
  
  <p>Would need to be able to run the code without using the <code>.cuda()</code> option which is for training using a GPU. Need to run it on my PC.</p>
  
  <p>Here's the source code in case needed.</p>
  
  <p><a href="https://github.com/tensorboy/PIDOptimizer" rel="nofollow noreferrer">https://github.com/tensorboy/PIDOptimizer</a></p>
  
  <p>Many thanks, community!</p>