layers介绍

Flatten和Dense介绍

优化器

损失函数

compile用法

第二个是onehot编码

模型训练 model.fit

 两种创建模型的方法

from tensorflow.python.keras.preprocessing.image import load_img,img_to_array
from tensorflow.python.keras.models import Sequential,Model
from tensorflow.python.keras.layers import Dense,Flatten,Input
import tensorflow as tf
from tensorflow.python.keras.losses import sparse_categorical_crossentropy def main(): #通过Sequential创建网络
model = Sequential(
[
Flatten(input_shape=(28,28)),
Dense(64,activation=tf.nn.relu),
Dense(128,activation=tf.nn.relu),
Dense(10,activation=tf.nn.softmax)
]
)
print(model) #通过Model创建模型
data = Input(shape=(784,))
out = Dense(64)(data)
model_sec = Model(inputs=data,outputs=out)
print(model_sec)
print(model.layers,model_sec.layers)
print(model.input,model.output)
print(model.summary())
print(model_sec.summary()) if __name__ == '__main__':
main()

  

最新文章

  1. UESTC 1227 & POJ 3667 Hotel
  2. sql for xml 嵌套
  3. 360网站卫士推出google字体加速方案
  4. Moloch
  5. Apache 多站点(虚拟主机)
  6. 基于HCE移动支付研究报告
  7. Android设置全屏
  8. 编译 & 预处理
  9. 要重定向 IO 流,Process 对象必须将 UseShellExecute 属性设置为 False。
  10. Exynos4412交叉编译环境搭建
  11. 个人jQuery的使用总结
  12. python学习日记(常用模块)
  13. c++实验二
  14. JSTL和EL的使用
  15. HttpWebRequest简单使用
  16. .NET Core 2.1中的HttpClientFactory最佳实践
  17. (转)The C10K problem翻译
  18. Android UI开发神兵利器之Android Action Bar Style Generator
  19. C# 如何获取鼠标在屏幕上的位置,不论程序是否为活动状态
  20. [CQOI2009]叶子的染色

热门文章

  1. web样式css
  2. coding++:mybatis update foreach (SQL循环)批量更新
  3. Prism 源码解读5-数据绑定和命令
  4. ThreadAbortException是可以传递的
  5. __str_方法和__repr__的区别
  6. [洛谷1437&Codevs1257]敲砖块<恶心的dp>
  7. 创建Windows10无人值守(自动应答文件)教程
  8. Day20-tomcat
  9. Django之queryset API
  10. 如何做监控?Google SRE 解密