tensorflow - NotImplementedError:TPU 不支持类型为 AssignVariableOp (AssignVariableOp) 的操作进行推理
问题描述
我正在尝试导出 TPUEstimator 类型的分类器的 SavedModel。由于我试图导出模型以在 GPU/CPU 上运行预测,因此 TPUEstimator 的 use_tpu 参数设置为 False。
当我尝试保存模型时,抛出以下错误:
NotImplementedError: Operation of type AssignVariableOp
(AssignVariableOp) is not supported on the TPU for inference. Execution
will fail if this op is used in the graph. Make sure your variables are
using variable_scope.
由于我计划通过 GPU/CPU 为模型提供服务,因此 Op 应该不是问题。如何将此估算器导出为 SavedModel?
解决方案
这可能会有所帮助,就在调用 export_savedmodel(...) 之前
estimator._export_to_tpu = False
推荐阅读
- java - 在 GWT 上的某个位置缩放图像
- docker - 如何实现对 docker-compose.yml 所做的更改以分离运行的容器
- json - STRING_ESCAPE json 正斜杠
- html - 使 -1 在
- sapui5 - 如何在 SAPUI5 中加载模板文本文件?
- javascript - Javascript - Redux 操作不会连续运行
- swift - 如何使用 Rx-MVVM-C 处理带有可观察对象的导航
- python - Python3 - traceroute 的正则表达式编译
- c - 当窗口超过 8 列时,边框无法正确绘制
- python - 按第二列选择 sqlite3 行