TensorFlow 是 Google 开发的开源机器学习框架,适合初学者和进阶开发者构建各种 AI 模型。以下是入门指南:
安装 TensorFlow
- 通过 pip 安装:
pip install tensorflow
- 或下载预编译版本 🔗 TensorFlow 官网
- 通过 pip 安装:
基础概念
- 张量(Tensor):数据的基本单位,多维数组
- 图(Graph):计算流程的可视化表示
- 会话(Session):执行图的环境
第一个程序
import tensorflow as tf hello = tf.constant("Hello, TensorFlow!") sess = tf.Session() print(sess.run(hello))
💡 运行结果会显示
Hello, TensorFlow!
,标志着环境配置成功学习资源