numpy追加3D矩阵

时间:2017-07-11 15:16:07

标签: numpy

当我numpy.append两个三维矩阵时会发生什么?

实施例。 a是形状矩阵(662,887,3),b是形状(77, 103, 100)的矩阵。

我使用numpy.append创建了一个形状为c的矩阵(2554682,)

这是什么意思?这里发生了什么?

1 个答案:

答案 0 :(得分:2)

function DateDiff(b, e) { let endYear = e.getFullYear(), endMonth = e.getMonth(), years = endYear - b.getFullYear(), months = endMonth - b.getMonth(), days = e.getDate() - b.getDate(); if (months < 0) { years--; months += 12; } if (days < 0) { months--; days += new Date(endYear, endMonth, 0).getDate(); } return [years, months, days]; } [years, months, days] = DateDiff( new Date("October 21, 1980"), new Date("July 11, 2017")); // 36 8 20 * 662 * 887)+(3 * 77 * 103)= 100

它将所有元素压缩成一维向量,元素数量是2554682a元素总和的总和。