bayespy.utils.linalg.outer

bayespy.utils.linalg.outer(A, B, ndim=1)[source]

Computes outer product over the last axes of A and B.

The other axes are broadcasted. Thus, if A has shape (…, N) and B has shape (…, M), then the result has shape (…, N, M).

Using the argument ndim it is possible to change that how many axes trailing axes are used for the outer product. For instance, if ndim=3, A and B have shapes (…,N1,N2,N3) and (…,M1,M2,M3), the result has shape (…,N1,M1,N2,M2,N3,M3).