def METHOD_NAME(a, b):
    n = a.shape[1]
    if tf.rank(b) == 1:
        x = tf.squeeze(tf.linalg.METHOD_NAME(a, tf.expand_dims(b, -1), fast=False), -1)
    else:
        x = tf.linalg.METHOD_NAME(a, b, fast=False)
    residuals = tf.norm(tf.tensordot(a, x, 1) - b, axis=0) ** 2
    return x, residuals if tf.linalg.matrix_rank(a) == n else tf.constant([])