美文网首页
flatten怎么用?

flatten怎么用?

作者: 夕宝爸爸 | 来源:发表于2019-03-11 17:47 被阅读0次

quora上的一个回答很简明
Suppose you’re using a Convolutional Neural Network whose initial layers are Convolution and Pooling layers. They layers have multidimensional tensors as their outputs. If you wanted to use a Dense(a fully connected layer) after your convolution layers, you would need to ‘unstack’ all this multidimensional tensor into a very long 1D tensor. You can achieve this using Flatten.

For instance if the output of the previous layer is of shape
(15, 3, 3, 4)
flatten unstacks all the tensor values into a 1-D tensor of shape
(15x3x3x4,)
so that it can be used as input for a Dense layer.

In short whenever you need to convert a multidimensional tensor into a single 1-D tensor, use can use Flatten.

相关文章

网友评论

      本文标题:flatten怎么用?

      本文链接:https://www.haomeiwen.com/subject/ghobpqtx.html