@tf_export("enable_eager_execution")
def enable_eager_execution(config=None,device_policy=None,execution_mode=None):"""Enables eager execution for the lifetime of this program.在此程序的生命周期内启用急切执行。Eager execution provides an imperative interface to TensorFlow. With eagerexecution enabled, TensorFlow functions execute operations immediately (asopposed to adding to a graph to be executed later in a `tf.Session`) andreturn concrete values (as opposed to symbolic references to a node in acomputational graph).急切的执行为TensorFlow提供了必要的接口。 启用急切执行后,TensorFlow函数立即执行操作(与添加到稍后在“ tf.Session”中执行的图相反)并返回具体值(与对计算图中的节点的符号引用相反)。For example:tf.enable_eager_execution()# After eager execution is enabled, operations are executed as they are# defined and Tensor objects hold concrete values, which can be accessed as# numpy.ndarray`s through the numpy() method.启用急切执行后,将按定义的方式执行操作,并且Tensor对象保留具体值,可通过numpy()方法以numpy.ndarray的形式访问这些值。# 断言,如果断言不正确,就会抛出assertion errorassert tf.multiply(6, 7).numpy() == 42Eager execution cannot be enabled after TensorFlow APIs have been used tocreate or execute graphs. It is typically recommended to invoke this functionat program startup and not in a library (as most libraries should be usableboth with and without eager execution).在使用TensorFlow API创建或执行图形之后,无法启用急切执行。 通常建议在程序启动时而不是在库中调用此函数(因为大多数库在有急执行或无急切执行的情况下都可用)。Args:config: (Optional.) A `tf.ConfigProto` to use to configure the environmentin which operations are executed. Note that `tf.ConfigProto` is alsoused to configure graph execution (via `tf.Session`) and many optionswithin `tf.ConfigProto` are not implemented (or are irrelevant) wheneager execution is enabled.tf.ConfigProto用于配置执行操作的环境。 请注意,`tf.ConfigProto`还用于配置图形执行(通过`tf.Session`),并且在启用急切执行时,`tf.ConfigProto`中的许多选项未实现(或不相关)。device_policy: (Optional.) Policy controlling how operations requiringinputs on a specific device (e.g., a GPU 0) handle inputs on a differentdevice  (e.g. GPU 1 or CPU). When set to None, an appropriate value will bepicked automatically. The value picked may change between TensorFlowreleases.控制需要特定设备(例如GPU 0)上的输入的操作如何处理不同设备(例如GPU 1或CPU)上的输入的策略。 设置为“无”时,将自动选择适当的值。 在TensorFlow版本之间选择的值可能会变化。Valid values:- tf.contrib.eager.DEVICE_PLACEMENT_EXPLICIT: raises an error if theplacement is not correct.- tf.contrib.eager.DEVICE_PLACEMENT_WARN: copies the tensors which are noton the right device but logs a warning.- tf.contrib.eager.DEVICE_PLACEMENT_SILENT: silently copies the tensors.Note that this may hide performance problems as there is no notificationprovided when operations are blocked on the tensor being copied betweendevices.- tf.contrib.eager.DEVICE_PLACEMENT_SILENT_FOR_INT32: silently copiesint32 tensors, raising errors on the other ones.-tf.contrib.eager.DEVICE_PLACEMENT_EXPLICIT:如果放置位置不正确,则会引发错误。-tf.contrib.eager.DEVICE_PLACEMENT_WARN:复制不在正确设备上的张量,但会记录警告。-tf.contrib.eager.DEVICE_PLACEMENT_SILENT:静默复制张量。请注意,这可能会隐藏性能问题,因为在设备之间复制张量时,如果操作被阻止,则不会提供任何通知。-tf.contrib.eager.DEVICE_PLACEMENT_SILENT_FOR_INT32:静默复制int32张量,从而在其他张量上产生错误。execution_mode: (Optional.) Policy controlling how operations dispatched areactually executed. When set to None, an appropriate value will be pickedautomatically. The value picked may change between TensorFlow releases.Valid values:控制实际执行调度的操作的策略。 设置为“无”时,将自动选择适当的值。 在TensorFlow版本之间选择的值可能会变化。- tf.contrib.eager.SYNC: executes each operation synchronously.- tf.contrib.eager.ASYNC: executes each operation asynchronously. Theseoperations may return "non-ready" handles.-tf.contrib.eager.SYNC:同步执行每个操作。-tf.contrib.eager.ASYNC:异步执行每个操作。 这些操作可能会返回“未就绪”句柄。Raises:ValueError: If eager execution is enabled after creating/executing aTensorFlow graph, or if options provided conflict with a previous callto this function.如果在创建/执行TensorFlow图后启用了急切执行,或者提供的选项与对该函数的先前调用冲突。"""if context.default_execution_mode != context.EAGER_MODE:return enable_eager_execution_internal(config=config,device_policy=device_policy,execution_mode=execution_mode,server_def=None)

tensorflow tf.enable_eager_execution()(立即执行操作,不添加到稍后在“ tf.Session”中执行的图)相关推荐

  1. c#执行多句oracle,在Oracle命令C#中执行多次插入表命令

    我想在单个Oracle Command中执行以下所有插入表语句的操作吗? OracleCommand cmd = new OracleCommand(); var parameter = cmd.Pa ...

  2. 在python中查看关键字、需要在解释器中执行_现有代码 d={},在python3解释器中执行 d[([1,2])] = 'b'得到的结果为():...

    [填空题]运动训练对心率变化影 响 目的: 探索性别.训练频率.训练方法.训练强度.训练年限等对心率变化的影响. 1.1 对象与方法 1.1 实验对象: 体育专业大学生....... 1.2 实验测试 ...

  3. linux执行cli文件,linux – 如何“撤消”在终端/ CLI中执行的“解压缩”?

    我知道这可能是一个拙劣的unTAR,虽然我不记得确切的命令-.但是有可能"撤消"最近的"解压缩"命令,在这种情况下,使用mac终端? 这是在10.7,with ...

  4. 对比tensorflow查看打印输出张量Tensor的两种方法(急切执行tf.enable_eager_execution()和tf.Session.run())

    第一种:tf.enable_eager_execution() # -*- coding: utf-8 -*- """ @File : 111.py @Time : 20 ...

  5. JDBC连接数据库及其执行操作

    作者:Alvin 功能:数据库连接与实现增删改查 时间:2019年3月4日08点33分 参考文章:https://www.2cto.com/database/201805/743741.html 一. ...

  6. Tensorflow学习四---高阶操作

    Tensorflow学习四-高阶操作 Merge and split 1.tf.concat 拼接 a = tf.ones([4,32,8]) b = tf.ones([2,32,8]) print( ...

  7. 乐视网:贾跃亭解质押150万股股票系法院司法执行操作

    [TechWeb]2月14日消息,乐视网今日发布公告称,2月13日,大股东贾跃亭对所持公司的150万股股票进行解质押,本次解质押股份占公司总股本的 0.0376%.根据贾跃亭邮件回复,贾跃亭本次股票解 ...

  8. 如何在Lattice CPLD XO2系列器件中执行TransFR(透明传输)操作?

    向博主本人提问FPGA相关问题 转载自:如何在lattice-cpld-xo2系列器件中执行transfr透明传输操作 如何在Lattice CPLD XO2系列器件中执行TransFR(透明传输)操 ...

  9. 多玩YY语音的面试题 C++中如何在main 函数之前执行操作

    多玩YY语音的面试题:C++中如何在main()函数之前执行操作? 第一反应main()函数是所有函数执行的开始.但是问题是main()函数执行之前如何执行呢? 联想到MFC里面的 C**App类的t ...

最新文章

  1. 在Ubuntu11.10中安装配置OpenCV2.3.1和CodeBlocks
  2. oracle判断非空并拼接,oracle sql 判断字段非空,数据不重复,插入多跳数据
  3. linux开发神器--Tmux
  4. 全球及中国真空管太阳能集热器行业竞争状况及投资策略研究报告2021年版
  5. MS CRM 2011 RibbonExport Utility下载以及实用说明
  6. mysql 自动备份删除_mysql自动备份删除5天前的备份
  7. pip默认使用国内镜像地址
  8. mysql数据库导出时报错mysqldump: Got error: 145的解决方法
  9. linux开启hadoop服务,Hadoop 2.7.4 关闭与启动
  10. excel函数学习系列一
  11. python腾训面试_Google资深工程师推荐Python面试必须要看的15个问题
  12. VS2010中malloc的使用
  13. comsol学习中心:建模工作流程
  14. Qt 编译时遇到 error: [debug/qrc_music.cpp] Error 1
  15. Android | 安卓好用软件来袭,多御安全浏览器免费又强大
  16. springboot 使用mybatis-plus 配置乐观锁。
  17. 万字手撕七大排序(代码+动图演示)
  18. 【单片机项目】基于STM32的智能小车设计(一)流程设计
  19. 100个python算法超详细讲解:牛顿迭代法求方程根
  20. 利用Python实现QQ、微信消息定时发送/自动发送【支持发送文件】

热门文章

  1. DataSet case sensitive issue
  2. 【MM模块】Sub Range 供应商子范围
  3. 销售自己使用过的小汽车纳多少增值税
  4. System tuning中经常用到的一些Tcode
  5. smartform 打印预览时转PDF查看
  6. 高校数字化建设到底该如何推进?这篇方案值得一看
  7. 像淘宝一样“网购装修”,“当家”助推家装互联网走向“广域网”
  8. 和信贷财报:互金行业收缩压力之下的个体进击之道
  9. win7 java闪退_win7 sdk manager 闪退
  10. android log耗性能吗,一个高性能的Android日志库