一种降维方式

a=np.ones((4,2,2,3))
print(a.shape)
b=a[...,0]*a[...,2] # 这样可以降维度
print(b.shape)
c=a[...,0:1]*a[...,1:2] # 若0:1这里为这样就不会降维度
print(c.shape)

原文地址:https://www.cnblogs.com/tangjunjun/p/11503838.html