In Tensorflow, get the names of all the Tensors in a graph

前端 未结 10 699
独厮守ぢ
独厮守ぢ 2020-11-27 10:29

I am creating neural nets with Tensorflow and skflow; for some reason I want to get the values of some inner tensors for a given input, so I am usi

10条回答
  •  感动是毒
    2020-11-27 10:38

    Since the OP asked for the list of the tensors instead of the list of operations/nodes, the code should be slightly different:

    graph = tf.get_default_graph()    
    tensors_per_node = [node.values() for node in graph.get_operations()]
    tensor_names = [tensor.name for tensors in tensors_per_node for tensor in tensors]
    

提交回复
热议问题