0
我试图写一个函数,该函数在三维矩阵的列表..转换3D矩阵的列表到4D矩阵
所以..在列表中的每个元素具有形状(rows,cols, some_scalar).
。 我想它重塑成4D矩阵.. 所以output = (number_of_elements_in_matrix, rows,cols,some_scalar)
到目前为止,我是
output = np.zeros((len(list_of_matrices), list_of_matrices[0].shape[0], list_of_matrices[0].shape[1],
list_of_matrices[0].shape[2]), dtype=np.uint8)
我怎么知道填补这一输出和值4D张..
def reshape_matrix(list_of_matrices):
output = np.zeros((len(list_of_matrices), list_of_matrices[0].shape[0], list_of_matrices[0].shape[1],
list_of_matrices[0].shape[2]), dtype=np.uint8)
return output
@Divakar:是的..这做的工作。如果你想将它写成一个答案? – Fraz