也许这个问题是基本的。但这确实使我感到困惑,并导致了错误。
import numpy as np
list1 = [np.matrix([[0, 1]]), np.matrix([[0,1]])]
np.stack(list1) # This gives matrix([[0, 1], [0, 1]]), which is expected
list2 = [np.matrix([[0.]]), np.matrix([[0.]])]
np.stack(list2) # This gives matrix([[0., 0.]]).
# But I thought this would output matrix([[0.], [0.]])
它有什么不同的行为?