利用tf的框架搭建一个如图的神经网络
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras import layers,optimizers,losses,datasets,Sequential
model=keras.Sequential([
layers.Dense(256,activation='relu'),
layers.Dense(256,activation='relu'),
layers.Dense(256,activation='relu'),
layers.Dense(10)
])
model.build(input_shape=(4,784))#模型的搭建
model.summary()#查看每一层的信息
#。以第一层为例,输入特征长度为 784,输 出特征长度为 256,当前层的参数量为 784 ∙ 256 + 256 = 200960 ,
# 同样的方法可以计算第 二、三、四层的参数量.