      """Train and evaluate a model."""
      print('training on', ctx)
      if isinstance(ctx, mx.Context):
          ctx = [ctx]
      for epoch in range(1, num_epochs + 1):
          train_l_sum, train_acc_sum, n, m = 0.0, 0.0, 0.0, 0.0
          start = time.time()
          for i, batch in enumerate(train_iter):
              Xs, ys, batch_size = _get_batch(batch, ctx)
              ls = []
              with autograd.record():
                  y_hats = [net(X) for X in Xs]
 
</s> remove     for epoch in range(1, num_epochs + 1):
        train_l_sum = 0
        train_acc_sum = 0
        start = time.time()
 </s> add     for epoch in range(num_epochs):
        train_l_sum, train_acc_sum, n, start = 0.0, 0.0, 0, time.time() </s> remove     """Train and evaluate a model on CPU."""
    for epoch in range(1, num_epochs + 1):
        train_l_sum = 0
        train_acc_sum = 0
 </s> add     """Train and evaluate a model with CPU."""
    for epoch in range(num_epochs):
        train_l_sum, train_acc_sum, n = 0.0, 0.0, 0 </s> remove     """Train and evaluate a model on CPU or GPU."""
 </s> add     """Train and evaluate a model with CPU or GPU.""" </s> remove     acc = nd.array([0])
    n = 0
 </s> add     acc_sum, n = nd.array([0]), 0 </s> remove         l_sum, start = 0.0, time.time()
 </s> add         l_sum, n, start = 0.0, 0, time.time()
    for epoch in range(num_epochs):
        train_l_sum, train_acc_sum, n, m, start = 0.0, 0.0, 0, 0, time.time()
      """Train and evaluate a model."""
      print('training on', ctx)
      if isinstance(ctx, mx.Context):
          ctx = [ctx]
    for epoch in range(num_epochs):
        train_l_sum, train_acc_sum, n, m, start = 0.0, 0.0, 0, 0, time.time()
    for epoch in range(num_epochs):
        train_l_sum, train_acc_sum, n, m, start = 0.0, 0.0, 0, 0, time.time()
    for epoch in range(num_epochs):
        train_l_sum, train_acc_sum, n, m, start = 0.0, 0.0, 0, 0, time.time()
          for i, batch in enumerate(train_iter):
              Xs, ys, batch_size = _get_batch(batch, ctx)
              ls = []
              with autograd.record():
                  y_hats = [net(X) for X in Xs]
keep keep keep keep replace replace replace keep keep keep keep keep
 gb 0.8.9, fix acc, loss computations 
gluonbook/utils.py