目录
TensorFlow 2.x基础
1、安装 TensorFlow 2.x
2、TensorFlow 2.x 基础概念
2、1 Eager Execution
2、2 TensorFlow 张量(Tensor)
3、使用Keras构建神经网络模型
3、1 构建 Sequential 模型
3、2 编译模型
1、Optimizer(优化器)
2、Loss(损失函数)
3、Metrics(评估指标)
3、3 训练模型
3、4 评估模型
3、5 预测
4、使用 TensorFlow 2.x 实现自定义训练循环
5、TensorFlow 2.x 高级功能
5、1 TensorFlow Dataset(数据管道)
5、2 TensorFlow Serving
5、3 TensorFlow Lite(模型优化和部署)
总结
TensorFlow 2.x基础
TensorFlow 2.x 是一个广泛使用的深度学习框架,特别适用于神经网络的构建和训练。与之前的版本相比,TensorFlow 2.x 提供了更加简洁和易用的 API,集成了 Keras 作为高层 API,并支持动态图(Eager Execution)。
1、安装 TensorFlow 2.x
首先,确保你已经安装了 TensorFlow 2.x。(Python 3.11.4)可以通过以下命令来安装:pip install tensorflow 查看:pip show tensorflow
Name: tensorflow
Version: 2.18.0
2、TensorFlow 2.x 基础概念