function - Under what condition can we use @tf.function?
问题描述
I have heard that tf.function
can build graph and accelerate computation. But when can we use it?
From another answer, seems like:
when we are not using built-in functions
Any more specific answer?
解决方案
这是一个计算 tf.function 优点的链接。想象一下你有一个损失函数,在你的函数顶部添加这个关键字可以帮助 Tensorflow 更快地运行它,但是你可能会遇到类似的错误
ValueError: tf.function-decorated function tried to create variables on non-first call.
如果您没有在第一次运行时初始化所有变量。
推荐阅读
- youtube-api - Youtube v3 playlistItems.insert api 返回 Video not found 404 错误,但视频已发布在正确的播放列表中
- floating-point - IEEE 单一格式的整数与浮点数
- pandas - 在 spark 数据帧上实现 pythonic 统计函数
- rust - 在 rust 中使用 reqwest 获取响应标头值
- c# - ASP .NET core 3.0 依赖注入抛出 System.InsufficientExecutionStackException
- c# - 设置 CheckBoxes isChecked 默认 WPF MVVM (System.NullReferenceException)
- ruby-on-rails - 使用载波将图像保存在 ruby on rails 中的问题并且反应图像值为空
- r - tidyverse:有效地绑定列表元素
- r - 如何根据R中的一列列表将一个数据帧中的值加到另一个数据帧中
- shiny - 如何使用多个事件识别在 observeEvent 中触发的事件