【TensorFlow】自学笔迹 | 开始Python编程

【TensorFlow】自学笔迹 | 开始Python编程_第1张图片
TensorFlow | Python

演示小程序:

# -*- coding:utf-8 -*-
'''
1.先导入tensorflow的python库
2.新建一个变量,constant方法操作
3.启动一个Session
4.运行计算图
5.关闭Session
'''

import tensorflow as tf

hw = tf.constant("Deep TensorFlow !")
session = tf.Session()
print(session.run(hw))
session.close
编程模式
  1. 命令式编程:Torch
  2. 符号式编程:Tensorflow (已优化)
TensorFlow基础结构
  1. 数据模型:Tensor(张量)
  2. 计算模型:Graph(图)
  3. 运行模型:Session(会话)
  • 张量是TensorFlow中最重要的结构
  • 数据(Data)
  • 流(Flow)
  • 图(Graph)
Session(会话)
  • Chrome打开一个浏览器就是打开了一个会话
  • TensorFlow使用了客户端和服务端的经典架构
  • 客户端是我们编写的程序,程序请求服务端(C++)的运行时
  • 创建一个会话,使用会话中的run方法
TensorFlow程序流程

1.定义算法的计算图(Graph)结构
2.使用会话(Session)执行计算

你可能感兴趣的:(【TensorFlow】自学笔迹 | 开始Python编程)