numpy.matrix.A1

等价于np.asarray(x).ravel()

x = np.matrix(np.arange(12).reshape((3,4))); x
matrix([[ 0,  1,  2,  3],
        [ 4,  5,  6,  7],
        [ 8,  9, 10, 11]])
x.getA1()
array([ 0,  1,  2, ...,  9, 10, 11])

Example from official site of numpy

猜你喜欢

转载自blog.csdn.net/STL_CC/article/details/106989752