• Graphs are data structures that contain:

    1. a set of tf.Operation objects,

      which representing units of computation;
    2. and tf.Tensor objects,

      which represent the units of data that flow between operations.
  • Graphs are defined in a tf.Graph context. 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.

    1. TensorFlow uses graphs as the format for saved models when it exports them from Python.
    2. 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.
    3. 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的更多相关文章

  1. 吴恩达课后习题第二课第三周:TensorFlow Introduction

    目录 第二课第三周:TensorFlow Introduction Introduction to TensorFlow 1 - Packages 1.1 - Checking TensorFlow ...

  2. 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 ...

  3. TensorFlow高层次机器学习API (tf.contrib.learn)

    TensorFlow高层次机器学习API (tf.contrib.learn) 1.tf.contrib.learn.datasets.base.load_csv_with_header 加载csv格 ...

  4. tensorflow 2.0 技巧 | 自定义tf.keras.Model的坑

    自定义tf.keras.Model需要注意的点 model.save() subclass Model 是不能直接save的,save成.h5,但是能够save_weights,或者save_form ...

  5. Tensorflow中的图(tf.Graph)和会话(tf.Session)详解

    Tensorflow中的图(tf.Graph)和会话(tf.Session) Tensorflow编程系统 Tensorflow工具或者说深度学习本身就是一个连贯紧密的系统.一般的系统是一个自治独立的 ...

  6. 关于TensorFlow2的tf.function()和AutoGraph的一些问题解决

    在使用TensorFlow的AutoGraph的时候出现了一些问题,特此记录 AutoGraph did not convert this function. Try decorating it di ...

  7. [TensorFlow] Introduction to TensorFlow Datasets and Estimators

    Datasets and Estimators are two key TensorFlow features you should use: Datasets: The best practice ...

  8. tensorflow共享变量 the difference between tf.Variable() and get_variable()

    一般这样用tf.get_variable(): v = tf.get_variable(name, shape, dtype, initializer) 下面内容来源于 http://blog.csd ...

  9. 『TensorFlow』流程控制之tf.identity

    一个详细介绍 下面程序要做的是,5次循环,每次循环给x加1,赋值给y,然后打印出来, x = tf.Variable(0.0) #返回一个op,表示给变量x加1的操作 x_plus_1 = tf.as ...

  10. 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 ...

随机推荐

  1. AutoFac(三)——装配扫描(批量注册之扫描类型)

    一.装配扫描 Autofac允许通过常规组装的方式去注册组件(构造方法.实例.lambda表达式等),您可以扫描和注册单个类型,也可以具体的扫描Autofac模块去注册. 1.扫描类型 除了已知的的常 ...

  2. 15.4K Star!Vercel官方出品,零基础构建企业级AI聊天机器人

    嗨,大家好,我是小华同学,关注我们获得"最新.最全.最优质"开源项目和高效工作学习方法 "基于Next.js 14和AI SDK打造的Chat SDK,让开发者快速构建支 ...

  3. 【深入解析AQS】从设计模式到ReentrantLock实现再到自定义锁

    深入解析AQS:设计模式.ReentrantLock实现与自定义锁开发 一.模板方法模式:AQS的架构基石 1.1 模式核心思想 模板方法模式通过固定算法骨架+可变实现细节的设计,实现了代码复用与扩展 ...

  4. Spring中的依赖注入DI

    目录 Spring中的依赖注入DI Spring中的依赖注入DI 依赖注入的简单理解就是给对象设置变量值. Spring配置文件 <?xml version="1.0" en ...

  5. js--弹出对话框、改变控件内容、验证输入邮箱的合法性

    <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title> ...

  6. 【记录】MATLAB矩阵的批量元素修改方式,与Python的NumPy对比

    文章目录 二维矩阵 操作 1. 将数组大于0的数全部加1 2. 删除元素 ①删除单个元素 ②删除一列元素 3. 添加一行或多行 ①添加一行 ②添加多行 4. 获取行/列数 5. 格式化输出数组 结构数 ...

  7. 赛前十天——打印输入字符串的全排列&&cls(java实现)

    package javaPractice; import java.util.Scanner; public class Contest13 { public static void main(Str ...

  8. Maven中配置maven-compiler-plugin 插件和jdk 17版本

    如何修改Maven工程的JDK版本 修改项目中的pom.xml文件,添加maven-compiler-plugin插件3.8.1版本,指定JDK的编译版本为Java 17,简约版配置信息如下: < ...

  9. Vue 学习笔记 [Part 2]

    作者:故事我忘了¢个人微信公众号:程序猿的月光宝盒 目录 一. 计算属性 1.1. 计算属性的本质 1.2. 计算属性和methods对比 〇.ES6补充 0.1. let/var 0.2 const ...

  10. 重新认识Clientset

    重新认识Clientset 1.介绍 Clientset 是调用 Kubernetes 资源对象最常用的客户端,可以操作所有的资源对象. 那么在 Clientset 中使如何用这些资源的呢? 因为在 ...