tensorflow 获取张量名

获取所有variable(每个op中可训练的张量)的name:

for variable_name in tf.global_variables():
    print(variable_name)

获取所有tensor(每个op的输出张量)的name:

for tensor_name in tf.contrib.graph_editor.get_tensors(tf.get_default_graph()):
    print(tensor_name)

获取所有op及其输入输出的name:

with tf.Session() as sess:
    for node in sess.graph_def.node:
        print(node)


全部评论

相关推荐

点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务