美文网首页
【TensorFlow】自学笔迹 | 开始Python编程

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

作者: 自动化丶智能小巫师 | 来源:发表于2018-04-19 18:04 被阅读0次
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编程

      本文链接:https://www.haomeiwen.com/subject/ttowkftx.html