请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

全连接层的input_shape问题

老师,为什么第一个Dense Layer的input_shape是(8,)?
官网里这样描述

Input shape:
N-D tensor with shape: (batch_size, …, input_dim). The most common situation would be a 2D input with shape (batch_size, input_dim).

我理解这里的input_dim就是这个8个维度,但为什么在代码里需要把它放在tuple的第二个位置?
我们这里没有设置batch size,如果要设置batch size=100,这个input_shape要写成(8,100)吗?
还是我理解的(8,)有误?
不懂,烦请老师仔细讲一下,谢谢!

正在回答 回答被采纳积分+3

1回答

正十七 2019-05-30 20:46:00

在keras的layers里面,是要把batch_size给省掉的,所以只有8。 具体文档https://www.tensorflow.org/versions/r2.0/api_docs/python/tf/keras/layers/InputLayer

input_shape: Shape tuple (not including the batch axis), or TensorShape instance (not including the batch axis).


0 回复 有任何疑惑可以回复我~
问题已解决,确定采纳
还有疑问,暂不采纳
意见反馈 帮助中心 APP下载
官方微信