SciTech-BigDataAIML-Tensorflow-Introduction to graphs and tf.function
Graphsare data structures that contain:a set of tf.Operation objects,
which representingunits of computation;- and
tf.Tensor objects,
which represent theunits of datathatflow between operations.
Graphsare defined in atf.Graphcontext. Since these graphs are data structures, they can be saved, run, and restored all without the original Python code.The benefits of graphs:
In short, graphs are extremely useful and let your TensorFlow run fast, run in parallel, and run efficiently on multiple devices.
However, you still want to define your machine learning models (or other computations) in Python for convenience, and then automatically construct graphs when you need them.- TensorFlow uses graphs as the format for saved models when it exports them from Python.
- With a graph, you have a great deal of flexibility. You can use your TensorFlow graph in environments that don't have a Python interpreter, like mobile applications, embedded devices, and backend servers.
- Graphs are also easily optimized, allowing the compiler to do transformations like:
Statically infer the value of tensors by folding constant nodes in your computation ("constant folding").
Separate sub-parts of a computation that are independent and split them between threads or devices.
Simplify arithmetic operations by eliminating common subexpressions.
There is an entire optimization system, Grappler, to perform this and other speedups.
SciTech-BigDataAIML-Tensorflow-Introduction to graphs and tf.function的更多相关文章
- 吴恩达课后习题第二课第三周:TensorFlow Introduction
目录 第二课第三周:TensorFlow Introduction Introduction to TensorFlow 1 - Packages 1.1 - Checking TensorFlow ...
- TensorFlow Saver 保存最佳模型 tf.train.Saver Save Best Model
TensorFlow Saver 保存最佳模型 tf.train.Saver Save Best Model Checkmate is designed to be a simple drop-i ...
- TensorFlow高层次机器学习API (tf.contrib.learn)
TensorFlow高层次机器学习API (tf.contrib.learn) 1.tf.contrib.learn.datasets.base.load_csv_with_header 加载csv格 ...
- tensorflow 2.0 技巧 | 自定义tf.keras.Model的坑
自定义tf.keras.Model需要注意的点 model.save() subclass Model 是不能直接save的,save成.h5,但是能够save_weights,或者save_form ...
- Tensorflow中的图(tf.Graph)和会话(tf.Session)详解
Tensorflow中的图(tf.Graph)和会话(tf.Session) Tensorflow编程系统 Tensorflow工具或者说深度学习本身就是一个连贯紧密的系统.一般的系统是一个自治独立的 ...
- 关于TensorFlow2的tf.function()和AutoGraph的一些问题解决
在使用TensorFlow的AutoGraph的时候出现了一些问题,特此记录 AutoGraph did not convert this function. Try decorating it di ...
- [TensorFlow] Introduction to TensorFlow Datasets and Estimators
Datasets and Estimators are two key TensorFlow features you should use: Datasets: The best practice ...
- tensorflow共享变量 the difference between tf.Variable() and get_variable()
一般这样用tf.get_variable(): v = tf.get_variable(name, shape, dtype, initializer) 下面内容来源于 http://blog.csd ...
- 『TensorFlow』流程控制之tf.identity
一个详细介绍 下面程序要做的是,5次循环,每次循环给x加1,赋值给y,然后打印出来, x = tf.Variable(0.0) #返回一个op,表示给变量x加1的操作 x_plus_1 = tf.as ...
- Tensorflow学习笔记(2):tf.nn.dropout 与 tf.layers.dropout
A quick glance through tensorflow/python/layers/core.py and tensorflow/python/ops/nn_ops.pyreveals t ...
随机推荐
- SQL 日常练习 (十八)
也没啥, 就是入坑 sql 根本停不下来, 势必要达到所谓 "精通" 的地步. 从网上的例子也快搬运完了, 而工作中的 sql 又是万万不能外泄了. 因此想着, 该去哪里搬砖呢, ...
- Nacos源码—8.Nacos升级gRPC分析三
大纲 7.服务端对服务实例进行健康检查 8.服务下线如何注销注册表和客户端等信息 9.事件驱动架构源码分析 7.服务端对服务实例进行健康检查 (1)服务端对服务实例进行健康检查的设计逻辑 (2)服务端 ...
- jdk8下载地址(附赠安装包)
jdk下载地址:https://jdk.java.net/ (文末已经为大家下好了,放在网盘里) 进去后点8,win. 安装好后,使用java -version命令如下: 成功安装jdk! 为大家提供 ...
- 面试官说又逮到一个不会用Git的
这里这写简要,要看具体的步骤及解释清移步:https://www.bilibili.com/read/cv10510952 如果是自己创建仓库写代码上传(demo是自己仓库的自定义名字): git i ...
- 20244104 实验一《Python程序设计》实验报告
20244104 2024-2025-2 <Python程序设计>实验x报告 课程:<Python程序设计> 班级:2441 姓名:陈思淼 学号:20244104 实验教师:王 ...
- 代码随想录第八天 | 字符串part02
还账还账,工作日欠下的账得今天补上,出来混,迟早要还的 151.翻转字符串里的单词 建议:这道题目基本把 刚刚做过的字符串操作 都覆盖了,不过就算知道解题思路,本题代码并不容易写,要多练一练. 题目链 ...
- HanTTS简单文档
先下载 https://gitee.com/dhfhub/HanTTS 然后输入命令 main.py synthesize --text 你的话 --src "syllables/" ...
- Windows加域后通过注册表取消壁纸锁定更换壁纸
打开注册表: 开始--运行--regedit (快捷键Win+R) 然后找到HKEY_CURRENT_USER ==> Software ==> Microsoft ==> Wind ...
- Golang操作Json
基本的序列化 首先我们来看看Go语言中json.Marshal()(序列化)与json.Unmarshal(反序列化)的基本用法. package main import ( "encodi ...
- Java IO<1>File类
java.io.File类 文件和文件目录路径的抽象表示形式,与平台无关 File 能新建.删除.重命名文件和目录,但 File 不能访问文件内容本身. 如果需要访问文件内容本身,则需要使用输入/输出 ...