NotImplementedError:在用于推理的TPU上不支持类型为AssignVariableOp(AssignV



我正在尝试导出类型为TPUEestimator的分类器的SavedModel。由于我试图导出模型以在GPU/CPU上运行预测,因此TPUEestimator的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(…(调用之前,这可能会有所帮助

估计量_export_to_tpu=错误

如果您实际上不需要TPU推理支持,您可以使用相同的模型_fn和训练模型创建一个tf.estimator.estimator,而不是tf.contrb.TPU.TPU estimator。然后,您应该能够导出模型。

相关内容

最新更新