def METHOD_NAME(self, shape):
    expected_exc = ValueError
    A_np = np.ones((3, 2, 4))
    B_np = np.ones((3, 4, 3))
    out_np = np.zeros(shape)
    A_num = num.ones((3, 2, 4))
    B_num = num.ones((3, 4, 3))
    out_num = num.zeros(shape)
    with pytest.raises(expected_exc):
        np.matmul(A_np, B_np, out=out_np)
    with pytest.raises(expected_exc):
        num.matmul(A_num, B_num, out=out_num)