How to know which tensor to choose from the list of tensor names in Graph?

冷暖自知 提交于 2019-12-11 04:14:07

问题


I am trying to export a Linear Classifier to a tflite format. That's why I need to select a tensor from the tensor list names in Graph.

For example for exporting a DNN classifier model the following input and output tensor were chosen:

input_tensor = sess.graph.get_tensor_by_name("dnn/input_from_feature_columns/input_layer/concat:0")
    input_tensor.set_shape([1, 4])
    out_tensor = sess.graph.get_tensor_by_name("dnn/logits/BiasAdd:0")
    out_tensor.set_shape([1, 3])

but for a Linear Classifier I don't know which one to use

I already print the list of tensors using:

for op in tf.get_default_graph().get_operations():
print (str(op.values()))

from that list I chose: input_tensor =

sess.graph.get_tensor_by_name("linear/concat:0") input_tensor.set_shape([1, 4])

but the shape doesn't correspond, I imagine that it is because the linear classifier works different as the DNN, but then how can I know which input tensor to choose?

来源:https://stackoverflow.com/questions/51267129/how-to-know-which-tensor-to-choose-from-the-list-of-tensor-names-in-graph

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!