def paired_manhattan_distances(X, Y):
 (X, Y) = check_paired_arrays(X, Y)
 diff = (X - Y)
 if issparse(diff):
  diff.data = np.abs(diff.data)
  return np.squeeze(np.array(diff.sum(axis=1)))
 else:
  return np.abs(diff).sum(axis=(-1))

def paired_manhattan_distances ( X , Y ) : ( X , Y ) = check_paired_arrays ( X , Y ) diff = ( X - Y ) if issparse ( diff ) : diff . data = np . abs ( diff . data ) return np . squeeze ( np . array ( diff . sum ( axis = 1 ) ) ) else : return np . abs ( diff ) . sum ( axis = ( - 1 ) )
compute the l1 distances between the vectors in x and y .