code: def get_distance(F, x):
      
      n = x.shape[0]
  
      square = F.sum(x ** 2.0, axis=1, keepdims=True)
      distance_square = square + square.transpose() - (2.0 * F.dot(x, x.transpose()))
  
      # Adding identity to make sqrt work.
      return F.sqrt(distance_square + F.array(np.identity(n)))
docs: Helper function for margin-based loss. Return a distance matrix given a matrix.