Python 如何在TF2中命名ops和tensor创建以帮助记录/调试?

Python 如何在TF2中命名ops和tensor创建以帮助记录/调试?,python,tensorflow,tensorflow2.0,Python,Tensorflow,Tensorflow2.0,我正在使用Tensorflow 2.0a和tf.debug.set\u log\u device\u placement(True)来记录每个操作的位置。但有些行动相当神秘。。对我来说,了解这些操作对应的是什么很重要,因为它们在CPU上运行,可能会减慢我的训练速度 特别是:VarIsInitializedOp、AssignVariableOp、ReadVariableOp 这些操作是否有一个清晰的映射到我可以在代码中标记的特定tf调用 Executing op VarHandleOp in de

我正在使用Tensorflow 2.0a和
tf.debug.set\u log\u device\u placement(True)
来记录每个操作的位置。但有些行动相当神秘。。对我来说,了解这些操作对应的是什么很重要,因为它们在CPU上运行,可能会减慢我的训练速度

特别是:
VarIsInitializedOp、AssignVariableOp、ReadVariableOp

这些操作是否有一个清晰的映射到我可以在代码中标记的特定tf调用

Executing op VarHandleOp in device /job:localhost/replica:0/task:0/device:CPU:0
2019-05-30 16:20:56.082274: I tensorflow/core/common_runtime/eager/execute.cc:394] Executing op VarHandleOp in device /job:localhost/replica:0/task:0/device:CPU:0
Executing op VarIsInitializedOp in device /job:localhost/replica:0/task:0/device:CPU:0
2019-05-30 16:20:56.082418: I tensorflow/core/common_runtime/eager/execute.cc:394] Executing op VarIsInitializedOp in device /job:localhost/replica:0/task:0/device:CPU:0
Executing op AssignVariableOp in device /job:localhost/replica:0/task:0/device:CPU:0
2019-05-30 16:20:56.084034: I tensorflow/core/common_runtime/eager/execute.cc:394] Executing op AssignVariableOp in device /job:localhost/replica:0/task:0/device:CPU:0
Executing op ReadVariableOp in device /job:localhost/replica:0/task:0/device:CPU:0
2019-05-30 16:20:56.258670: I tensorflow/core/common_runtime/eager/execute.cc:394] Executing op ReadVariableOp in device /job:localhost/replica:0/task:0/device:CPU:0