一种降维方式

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)

 

 

 

posted @ 2019-09-10 23:36  tangjunjun  阅读(212)  评论(0编辑  收藏  举报
https://rpc.cnblogs.com/metaweblog/tangjunjun