标签:rgba 移动 http code loading arrays 参数 连接数 port
numpy.stack 函数用于沿新轴连接数组序列,格式如下:
numpy.stack(arrays, axis)
参数说明:
arrays
相同形状的数组序列axis
:返回数组中的轴,输入数组沿着它来堆叠(深,高,宽)(0,1,2)经验证2x2数组插入axis轴后,原axis轴左移(超出原数组最高轴不用移动),维度加1。
1 import numpy as np 2 3 a=np.array([[1,2],[3,4]]) 4 b=np.array([[5,6],[7,8]]) 5 print(a) 6 print(b) 7 print(‘--------------------------------‘) 8 c=np.stack((a,b),axis=0) 9 print(c) 10 print(‘--------------------------------‘) 11 c=np.stack((a,b),axis=1) 12 print(c) 13 print(‘--------------------------------‘) 14 c=np.stack((a,b),axis=2) 15 print(c)
输出:
[[1 2] [3 4]] [[5 6] [7 8]] -------------------------------- [[[1 2] [3 4]] [[5 6] [7 8]]] -------------------------------- [[[1 2] [5 6]] [[3 4] [7 8]]] -------------------------------- [[[1 5] [2 6]] [[3 7] [4 8]]]
标签:rgba 移动 http code loading arrays 参数 连接数 port
原文地址:https://www.cnblogs.com/casperll/p/14415559.html