def compute_low_rank(self, tensor: torch.Tensor, normalizer: float) -> torch.Tensor:
    if tensor.requires_grad:
        tensor = tensor.detach()
    try:
        tensor_size = tensor.shape
        if (tensor_size[0] > tensor_size[1]):
            tensor = tensor.T
        (U_approx, S_approx, V_approx) = EVBMF(tensor)
    except RuntimeError:
        return (None, None, None)
    rank = (S_approx.shape[0] / tensor_size[0])
    low_rank_eigen = torch.diag(S_approx).data.cpu().numpy()
    if (len(low_rank_eigen) != 0):
        condition = (low_rank_eigen[0] / low_rank_eigen[(- 1)])
        sum_low_rank_eigen = (low_rank_eigen / max(low_rank_eigen))
        sum_low_rank_eigen = np.sum(sum_low_rank_eigen)
    else:
        condition = 0
        sum_low_rank_eigen = 0
    KG = (sum_low_rank_eigen / tensor_size[0])
    return (rank, KG, condition)
def compute_low_rank(self, tensor: torch.Tensor, normalizer: float) -> torch.Tensor:
    if tensor.requires_grad:
        tensor = tensor.detach()
    try:
        tensor_size = tensor.shape
        if (tensor_size[0] > tensor_size[1]):
            tensor = tensor.T
        (U_approx, S_approx, V_approx) = EVBMF(tensor)
    except RuntimeError:
        return (None, None, None)
    rank = (S_approx.shape[0] / tensor_size[0])
    low_rank_eigen = torch.diag(S_approx).data.cpu().numpy()
    if (len(low_rank_eigen) != 0):
        condition = (low_rank_eigen[0] / low_rank_eigen[(- 1)])
        sum_low_rank_eigen = (low_rank_eigen / max(low_rank_eigen))
        sum_low_rank_eigen = np.sum(sum_low_rank_eigen)
    else:
        condition = 0
        sum_low_rank_eigen = 0
    KG = (sum_low_rank_eigen / tensor_size[0])
    return (rank, KG, condition)