欢迎来到 TensorFlow 的世界!以下是你开始使用 TensorFlow 的第一步:
安装 TensorFlow 📦
- 使用 pip 安装:
pip install tensorflow
- 或访问 TensorFlow 官方安装指南 获取详细说明
- 使用 pip 安装:
核心概念速览 📚
- 张量(Tensor):数据的基本单位,可以是标量、向量、矩阵等
- 计算图(Graph):定义操作和数据流的结构
- 会话(Session):执行计算图的环境
- 变量(Variable):可更新的参数,用于训练模型
第一个 TensorFlow 程序 💻
import tensorflow as tf hello = tf.constant("Hello, TensorFlow!") sess = tf.Session() print(sess.run(hello))
运行结果将显示:
Hello, TensorFlow!
✅
📌 扩展学习: