【发布时间】:2016-04-15 01:52:33
【问题描述】:
在 [http://deeplearning.net/tutorial/lenet.html#lenet] 它说:
This will generate a matrix of shape (batch_size, nkerns[1] * 4 * 4),
# or (500, 50 * 4 * 4) = (500, 800) with the default values.
layer2_input = layer1.output.flatten(2)
当我在 numpy 3d 数组上使用 flatten 函数时,我得到一个 1D 数组。但在这里它说我得到了一个矩阵。在 theano 中 flatten(2) 是如何工作的?
numpy 上的一个类似示例生成一维数组:
a= array([[[ 1, 2, 3],
[ 4, 5, 6],
[ 7, 8, 9]],
[[10, 11, 12],
[13, 14, 15],
[16, 17, 18]],
[[19, 20, 21],
[22, 23, 24],
[25, 26, 27]]])
a.flatten(2)=array([ 1, 10, 19, 4, 13, 22, 7, 16, 25, 2, 11, 20, 5, 14, 23, 8, 17,
26, 3, 12, 21, 6, 15, 24, 9, 18, 27])
【问题讨论】:
标签: numpy theano flatten conv-neural-network