如何将 model/function 中使用的变量传递给 TensorFlow Estimator

How do I get variables used in model/function pass to TensorFlowEstimator

如何在模型拟合后获取变量(例如,嵌入 table、RNN 变量等),当使用 TensorFlowEstimator 进行拟合时,例如这里 skflow example?作为 tf.all_variables() returns 空列表。

您可以在估算器中使用 get_variable_names()

基本上,您需要获取图形然后调用 all_variables()。例如: with self._graph.as_default(): print([v.name for v in variables.all_variables()])