I was able to vectorize the single-sample batch code with the help of torch.cdist:
    tmp_b = - 1.0 / (2 * m * (m - 1)) * torch.sum(
        torch.pow(
            torch.cdist(
                y_pred.reshape(-1, m).T, y_pred.reshape(-1, m).T, p=2
            ), beta
        )
    )

Question 2 still stands. Anybody know how to vectorize this op for batch sizes > 1? Thanks.