code: def compute_distance(x_ori, x_pert, constraint='l2'):
    
    if constraint == 'l2':
      dist = np.linalg.norm(x_ori - x_pert)
    elif constraint == 'linf':
      dist = np.max(abs(x_ori - x_pert))
    return dist
docs: Compute the distance between two images.