Skip to main content

tensorflow 入门

· One min read

背景

最近chatgpt 很流行 ,所以想了解一下TensorFlow是怎么拟合数据的

python 版本

$python3 -V
Python 3.10.6

安装

安装分为pip 方式和jupyter方式

我用的是pip安装的方式

  • 下载安装 Miniconda
curl https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -o Miniconda3-latest-Linux-x86_64.sh
bash Miniconda3-latest-Linux-x86_64.sh
  • 创建一个叫tf 的environment
## 我的python是3.10 , 根据自己情况改
conda create --name tf python=3.10

  • 安装tf
(tf) dai@myhost:~$ pip install tensorflow==2.11.*
  • 测试运行
(tf) dai@myhost:~$ python3 -c "import tensorflow as tf; print(tf.reduce_sum(tf.random.normal([1000, 1000])))"

相关阅读