assert A.shape[:-1] == B.shape[:-1]
if result is None:
    result = scipy.zeros(A.shape + B.shape[-1:], dtype=A.dtype)
if A.ndim == 1:
    result[:, :] = scipy.outer(A, B)
else:
    for idx in range(A.shape[0]):
        array_outer_product(A[(idx), ...], B[(idx), ...], result[(idx), ...])
return result
Compute outer product of arrays with arbitrary dimensions