      trainer = gluon.Trainer(model.collect_params(), 'sgd',
                              {'learning_rate': lr, 'momentum': 0, 'wd': 0})
  
      for epoch in range(num_epochs):
          l_sum, start = 0.0, time.time()
          data_iter = data_iter_consecutive(
              corpus_indices, batch_size, num_steps, ctx)
          state = model.begin_state(batch_size=batch_size, ctx=ctx)
          for t, (X, Y) in enumerate(data_iter):
              for s in state:
                  s.detach()
 
</s> remove         for t, (X, Y) in enumerate(data_iter):
 </s> add         for X, Y in data_iter: </s> remove         for t, (X, Y) in enumerate(data_iter):
 </s> add         for X, Y in data_iter: </s> remove         l_sum, start = 0.0, time.time()
 </s> add         l_sum, n, start = 0.0, 0, time.time() </s> remove     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()
 </s> add     for epoch in range(num_epochs):
        train_l_sum, train_acc_sum, n, m, start = 0.0, 0.0, 0, 0, time.time() </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()
        l_sum, n, start = 0.0, 0, time.time()
        data_iter = gb.data_iter_consecutive(
      trainer = gluon.Trainer(model.collect_params(), 'sgd',
                              {'learning_rate': lr, 'momentum': 0, 'wd': 0})
  
      for epoch in range(num_epochs):
        l_sum, n, start = 0.0, 0, time.time()
        data_iter = gb.data_iter_consecutive(
        l_sum, n, start = 0.0, 0, time.time()
        data_iter = gb.data_iter_consecutive(
              corpus_indices, batch_size, num_steps, ctx)
          state = model.begin_state(batch_size=batch_size, ctx=ctx)
          for t, (X, Y) in enumerate(data_iter):
              for s in state:
                  s.detach()
keep keep keep keep replace replace keep keep keep keep keep
 gb 0.8.9, fix acc, loss computations 
gluonbook/utils.py