【Tensorflow1.0 和 Tensorflow2.0】—— 区别
tensorflow
一个面向所有人的开源机器学习框架
项目地址:https://gitcode.com/gh_mirrors/te/tensorflow

·
一、搭建深度学习模型的区别(背过!!!)
对于Tensorflow1.0,
step 01 :准备输入数据
step 02:定义输入PlaceHolder
step 03:搭建模型
step 04:定义损失函数及优化器
step 05:初始化所有变量
step 06:创建会话session
step 07:传参计算session.run()
对于Tensorflow 2.0,
step 01 :准备输入数据
step 02:定义输入PlaceHolder
tensorflow
一个面向所有人的开源机器学习框架
项目地址:https://gitcode.com/gh_mirrors/te/tensorflow
step 03:搭建模型
step 04:定义损失函数及优化器
step 05:初始化所有变量
step 06:创建会话session
step 07:传参计算model()
二、TensorFlow 2.0 相比于TensorFlow 1.0 的其他区别
1. TensorFlow 2.0 动态图机制默认开启,方便开发者调试。
TensorFlow 1.0 默认是静态图,需要手动开启动态图。
2. tf.keras模块上的区别
- Keras是对TensorFlow的更高一层封装,简化了TensorFlow的使用。
- TensorFlow 2.0中搭建网络,官方推荐使用Keras提供的方法。有两种搭建风格:Keras Function API (tf1中搭建模型的风格)和 Model Subclassing API(类似于Pytorch中搭建模型的风格)
- TensorFlow 2.0 删除了重复、废弃的API。而在TensorFlow 1.0,同一个功能可以找到多个API实现,会给开发者造成疑惑。
3.在TensorFlow 2.0 中使用 @tf.function 装饰器,构造高效的Python代码




一个面向所有人的开源机器学习框架
最近提交(Master分支:1 个月前 )
4f64a3d5
Instead, check for this case in `ResolveUsers` and `ResolveOperand`, by querying whether the `fused_expression_root` is part of the `HloFusionAdaptor`.
This prevents us from stepping into nested fusions.
PiperOrigin-RevId: 724311958
1 个月前
aa7e952e
Fix a bug in handling negative strides, and add a test case that exposes it.
We can have negative strides that are not just -1, e.g. with a combining
reshape.
PiperOrigin-RevId: 724293790
1 个月前
更多推荐
目录
所有评论(0)