CNN flatten trick

# A trick when you want to flatten a matrix X of shape (a,b,c,d)
# to a matrix X_flatten of shape (b*c*d, a) is to use:
a = np.random.randn(10, 5, 5, 3)
## a105*5*3的图像
a_flatten = a.reshape(a.shape[0], -1)
print(a_flatten.shape)
## 输出为(10, 75)

猜你喜欢

转载自blog.csdn.net/weixin_41947081/article/details/80754007
CNN