# How can I get output name from graph runtime

**URL:** <https://discuss.tvm.apache.org/t/how-can-i-get-output-name-from-graph-runtime/8479>\
**Category:** Questions\
**Created:** [November 18, 2020, 6:15am UTC](https://discuss.tvm.apache.org/t/how-can-i-get-output-name-from-graph-runtime/8479 "2020-11-18T06:15:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![juierror](https://discuss.tvm.apache.org/letter_avatar_proxy/v4/letter/j/7ba0ec/32.png) [@juierror](https://discuss.tvm.apache.org/u/juierror)\
**Post date:** [November 18, 2020, 6:15am UTC](https://discuss.tvm.apache.org/t/how-can-i-get-output-name-from-graph-runtime/8479/1 "2020-11-18T06:15:23Z")

</div>

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](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.

---

<div class="post-metadata">

**Author:** ![FrozenGene](https://discuss.tvm.apache.org/user_avatar/discuss.tvm.apache.org/frozengene/32/1114_2.png) [@FrozenGene](https://discuss.tvm.apache.org/u/FrozenGene)\
**Post date:** [November 18, 2020, 9:01am UTC](https://discuss.tvm.apache.org/t/how-can-i-get-output-name-from-graph-runtime/8479/2 "2020-11-18T09:01:22Z")

</div>

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](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.

---

<div class="post-metadata">

**Author:** ![juierror](https://discuss.tvm.apache.org/letter_avatar_proxy/v4/letter/j/7ba0ec/32.png) [@juierror](https://discuss.tvm.apache.org/u/juierror)\
**Post date:** [November 18, 2020, 10:33am UTC](https://discuss.tvm.apache.org/t/how-can-i-get-output-name-from-graph-runtime/8479/3 "2020-11-18T10:33:00Z")

</div>

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