      for param in params:
          param[:] = param - lr * param.grad
  
  def sgd(params, lr, batch_size):
      for param in params:
          param[:] = param - lr * param.grad / batch_size
  
  def accuracy(output, label):
      """Get accuracy."""
 
</s> remove     return nd.mean(output.argmax(axis=1)==label).asscalar()

 </s> add     """Get accuracy."""
    return (output.argmax(axis=1) == label).mean().asscalar() </s> remove     n = 0.
    if isinstance(data_iterator, mx.io.MXDataIter):
        data_iterator.reset()
    for batch in data_iterator:
        data, label, batch_size = _get_batch(batch, ctx)
        for X, y in zip(data, label):
 </s> add     n = 0
    if isinstance(data_iter, mx.io.MXDataIter):
        data_iter.reset()
    for batch in data_iter:
        features, labels, batch_size = _get_batch(batch, ctx)
        for X, y in zip(features, labels): </s> remove             acc += nd.sum(net(X).argmax(axis=1)==y).copyto(mx.cpu())
 </s> add             acc += (net(X).argmax(axis=1)==y).sum().copyto(mx.cpu()) </s> remove                 output = net(features)
                loss = square_loss(output, label)
            loss.backward()
 </s> add                 l = loss(net(X), y)
            l.backward()
    """Mini-batch stochastic gradient descent."""
      for param in params:
          param[:] = param - lr * param.grad
  
  def sgd(params, lr, batch_size):
    """Mini-batch stochastic gradient descent."""
      for param in params:
          param[:] = param - lr * param.grad / batch_size
  
  def accuracy(output, label):
      """Get accuracy."""
keep keep keep add keep keep keep keep keep
 apply gluonbook in dl basics, cnn, remove gluonbook deps 
gluonbook/utils.py