if use_cuda:
          input, target, hidden = input.cuda(), target.cuda(), hidden.cuda()
      ...  # get loss and optimize
      total_loss += loss.data[0]
# evaluate
  for input, target in test_loader:
      input = Variable(input, volatile=True)
      if use_cuda:
          ...
      ...
  ```

0.4.0 (new):
  ```python
  # torch.device object used throughout this script
  device = torch.device("cuda" if use_cuda else "cpu")

model = MyRNN().to(device)
# train
  total_loss = 0
  for input, target in train_loader:
      input, target = input.to(device), target.to(device)
      hidden = input.new_zeros(*h_shape)  # has the same device & dtype as input
      ...  # get loss and optimize
      total_loss += loss.item()           # get Python number from 1-element Tensor
# evaluate
  with torch.no_grad():                   # operations inside don't track history
      for input, target in test_loader:
          ...
  ```