How to know which tensor to choose from the list o

2019-07-23 08:12发布

问题:

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?