                  [0, 64, 0], [128, 64, 0], [0, 192, 0], [128, 192, 0],
                  [0, 64, 128]]
  
  
  def accuracy(y_hat, y):
      """Get accuracy."""
      return (y_hat.argmax(axis=1) == y.astype('float32')).mean().asscalar()
  
  
  def bbox_to_rect(bbox, color):
      """Convert bounding box to matplotlib format."""
      return plt.Rectangle(xy=(bbox[0], bbox[1]), width=bbox[2]-bbox[0],
                           height=bbox[3]-bbox[1], fill=False, edgecolor=color,
                           linewidth=2)
 
</s> remove             gutils.split_and_load(labels, ctx),
            features.shape[0])
 </s> add             gutils.split_and_load(labels, ctx), features.shape[0]) </s> remove         acc.wait_to_read()
    return acc.asscalar() / n
 </s> add         acc_sum.wait_to_read()
    return acc_sum.asscalar() / n </s> remove             acc += (net(X).argmax(axis=1) == y).sum().copyto(mx.cpu())
 </s> add             acc_sum += (net(X).argmax(axis=1) == y).sum().copyto(mx.cpu()) </s> remove             train_l_sum += l.mean().asscalar()
            train_acc_sum += accuracy(y_hat, y)
 </s> add             y = y.astype('float32')
            train_l_sum += l.asscalar()
            train_acc_sum += (y_hat.argmax(axis=1) == y).sum().asscalar()
            n += y.size </s> remove             train_l_sum += l.mean().asscalar()
            train_acc_sum += accuracy(y_hat, y)
 </s> add             y = y.astype('float32')
            train_l_sum += l.asscalar()
            train_acc_sum += (y_hat.argmax(axis=1) == y).sum().asscalar()
            n += y.size
                  [0, 64, 0], [128, 64, 0], [0, 192, 0], [128, 192, 0],
                  [0, 64, 128]]
  
  





  def bbox_to_rect(bbox, color):
      """Convert bounding box to matplotlib format."""
      return plt.Rectangle(xy=(bbox[0], bbox[1]), width=bbox[2]-bbox[0],
                           height=bbox[3]-bbox[1], fill=False, edgecolor=color,
                           linewidth=2)
keep keep keep keep replace replace replace replace replace keep keep keep keep keep
 gb 0.8.9, fix acc, loss computations 
gluonbook/utils.py