当我numpy.append
两个三维矩阵时会发生什么?
实施例。
a
是形状矩阵(662,887,3),b
是形状(77, 103, 100)
的矩阵。
我使用numpy.append
创建了一个形状为c
的矩阵(2554682,)
。
这是什么意思?这里发生了什么?
答案 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
它将所有元素压缩成一维向量,元素数量是2554682
和a
元素总和的总和。