我想做以下事情:
vectors = hstack(((array([[nA, nM, nE]])),
        nP.T,(array([[nM,nA]]))))
tile(P[newaxis, newaxis, newaxis,
        ...,newaxis,newaxis], vectors)
但是,我收到一条错误消息。接下来,我使用了几个变量的输出/内容:
# output:
print vectors.shape: (1L, 14L)
print vectors: array([[ 3.,  2.,  5.,  2.,  2.,  4.,  4.,  4.,  8.,  8.,  8.,  8.,  2.,  3.]])
print P.shape: (2L, 2L, 4L, 4L, 4L, 8L, 8L, 8L, 8L)
print P[newaxis, newaxis, newaxis,
        ...,newaxis,newaxis].shape: (1L, 1L, 1L, 2L, 2L, 4L, 4L, 4L, 8L, 8L, 8L, 8L, 1L, 1L)
tile(P[newaxis, newaxis, newaxis,
        ...,newaxis,newaxis], vectors): ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all() (somewhere inside tile())
最后是完整的追溯:
ValueError                                Traceback (most recent call last)
<ipython-input-1050-25019e870a05> in <module>()
      1 P = tile(P[newaxis, newaxis, newaxis,
----> 2     ...,newaxis,newaxis], vectors)
C:\Users\sdaro\AppData\Local\Enthought\Canopy\User\lib\site-packages\numpy\lib\shape_base.pyc in tile(A, reps)
    831         tup = (1,)*(c.ndim-d) + tup
    832     for i, nrep in enumerate(tup):
--> 833         if nrep!=1:
    834             c = c.reshape(-1,n).repeat(nrep,0)
    835         dim_in = shape[i]
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()