How can I get output name from graph runtime

I read the docs and have a question about how can we know what is the output we get from graph runtime.

For example, I have model A that have 3 outputs.

The 3 outputs is

  1. name: LayerA, shape: (1, 100)
  2. name: LayerB, shape: (1, 100)
  3. name: LayerC, shape: (1, 100, 200)

I see the this function https://tvm.apache.org/docs/api/python/graph_runtime.html#tvm.contrib.graph_runtime.GraphModule.get_output. How can I know what is the index 0. Is it LayerA? The work around solution I think is the match the output shape and see what is the layer name. However, If I have the output that have the same shape, what should I do? Can I get some output name from module?

Thank you.

Good question. I think we can not get it directly currently. But the mechanism should have support it. For example, when you pass the output index, we could use nodes_[outputs_[index].node_id].name to get the name.

Something a bit more, I think the name you want more is the model’s name, then you need the pr https://github.com/apache/incubator-tvm/pull/6885 for frontend keeping model node’s name and pass this name to TVM node correctly. Then previous code could get the correct output name for you.

Thank you very much! I will check the PR that you send to me.