将3d矩阵列表转换为4d矩阵

2024-04-27 04:46:48 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在写一个函数,它接受一个3d矩阵的列表。。在

所以。。列表中的每个元素都有(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张量。。在

^{pr2}$

Tags: of函数元素列表outputnp矩阵some