numpy中的concatenate函数
import numpy as np
a = np.arange(8).reshape(2,2,2)
print('a',a)
print(np.shape(a))
b = np.arange(8).reshape(2,2,2)
print('b',b)
print(np.shape(b))
c=np.concatenate((a, b), axis=0) # axis=0是行,axis=1是列,缺省是行
print('c',c)
print(np.shape(c))
print(len(c))
d=np.concatenate((a, b), axis=1)
print('d',d)
print(np.shape(d))
print(len(d))
f=np.concatenate((a, b))
print('f',f)
print(np.shape(f))
print(len(f))
a [[[0 1]
[2 3]]
[[4 5]
[6 7]]]
(2, 2, 2)
b [[[0 1]
[2 3]]
[[4 5]
[6 7]]]
(2, 2, 2)
c [[[0 1]
[2 3]]
[[4 5]
[6 7]]
[[0 1]
[2 3]]
[[4 5]
[6 7]]]
(4, 2, 2)
4
d [[[0 1]
[2 3]
[0 1]
[2 3]]
[[4 5]
[6 7]
[4 5]
[6 7]]]
(2, 4, 2)
2
f [[[0 1]
[2 3]]
[[4 5]
[6 7]]
[[0 1]
[2 3]]
[[4 5]
[6 7]]]
(4, 2, 2)
4