Creating variables on a non-first call to a function decorated with tf.function.解决方法!

Creating variables on a non-first call to a function decorated with tf.function.解决方法!

Creating variables on a non-first call to a function decorated with tf.function.解决方法!

1. 如下图所示,使用该修饰器可加速网络的推理速度,但有时会报错Creating variables on a non-first call to a function decorated with tf.function.

在这里插入图片描述

2. 接下来只要在该修饰器上方加入该行代码即可

在这里插入图片描述

tf.config.run_functions_eagerly(True)

以上就是全部内容

  • 2
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
Python Crash Course is a fast-paced, thorough introduction to programming with Python that will have you writing programs, solving problems, and making things that work in no time. In the first half of the book, you'll learn about basic programming concepts, such as lists, dictionaries, classes, and loops, and practice writing clean and readable code with exercises for each topic. You'll also learn how to make your programs interactive and how to test your code safely before adding it to a project. In the second half of the book, you'll put your new knowledge into practice with three substantial projects: a Space Invaders-inspired arcade game, data visualizations with Python's super-handy libraries, and a simple web app you can deploy online. As you work through Python Crash Course, you'll learn how to: Use powerful Python libraries and tools, including matplotlib, NumPy, and Pygal Make 2D games that respond to keypresses and mouse clicks, and that grow more difficult as the game progresses Work with data to generate interactive visualizations Create and customize simple web apps and deploy them safely online Deal with mistakes and errors so you can solve your own programming problems If you've been thinking seriously about digging into programming, Python Crash Course will get you up to speed and have you writing real programs fast. Why wait any longer? Start your engines and code! Table of Contents Part I: Basics Chapter 1: Getting Started Chapter 2: Variables and Simple Data Types Chapter 3: Introducing Lists Chapter 4: Working with Lists Chapter 5: if Statements Chapter 6: Dictionaries Chapter 7: User Input and while Loops Chapter 8: Functions Chapter 9: Classes Chapter 10: Files and Exceptions Chapter 11: Testing Your Code Part II: Projects Project 1: Alien Invasion Project 2: Data Visualization Project 3: Web Applications Appendix A: Installing Python Appendix B: Text Editors Appendix C: Getting Help Appendix D: Using Git for Version Control

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值