我爱编程

TensorFlow--系列1入门

2018-05-15  本文已影响20人  慢牛策略

1 Mac系统安装及测试--Installing with Virtualenv

1  安装步骤:
安装pip
pip安装Virtualenv
安装python(选择版本),创建Virtualenv运行环境
激活Virtualenv环境,安装TensorFlow

启动和关闭:
$ cd targetDirectory
$ source ./bin/activate      # If using bash, sh, ksh, or zsh
$ source ./bin/activate.csh  # If using csh or tcsh 

 (targetDirectory)$ deactivate 

2 TensorFlow使用入门

2.1 The programming stack
tensorflow_programming_environment.png
demo测试:
git clone https://github.com/tensorflow/models
cd models/samples/core/get_started/
python premade_estimator.py

如果未报错,说明安装成功。
2.2To write a TensorFlow program based on pre-made Estimators, you must perform the following tasks:
-1 Create one or more input functions.
-2 Define the model's feature columns.
-3 Instantiate an Estimator, specifying the feature columns and various hyperparameters.
-4 Call one or more methods on the Estimator object, passing the     appropriate input function as the source of the data.

TensorFlow运行MINST例子:
上一篇下一篇

猜你喜欢

热点阅读