bayespy.utils.misc.get_diag

bayespy.utils.misc.get_diag(X, ndim=1, ndim_to=0)[source]

Get the diagonal of an array.

If ndim>1, take the diagonal of the last 2*ndim axes.