Skip to content

[Runtime] Add graph_executor get_input_index API.#8633

Merged
masahi merged 5 commits into
apache:mainfrom
huajsj:inputindx
Aug 4, 2021
Merged

[Runtime] Add graph_executor get_input_index API.#8633
masahi merged 5 commits into
apache:mainfrom
huajsj:inputindx

Conversation

@huajsj

@huajsj huajsj commented Aug 3, 2021

Copy link
Copy Markdown
Contributor

In graph_executor use case, user can use set_input with input index to set input parameter, but there is no straight
forward way to get correct index number with input name, here provide get_input_index API to do such work.

In graph_executor use case, user can use set_input with
input index to set input parameter, but there is no straight
forward way to get correct index number with input name, here
provide get_input_index API to do such work.

@jcf94 jcf94 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Comment thread python/tvm/contrib/graph_executor.py Outdated
Comment thread python/tvm/contrib/graph_executor.py Outdated
Comment thread python/tvm/contrib/graph_executor.py
Comment thread src/runtime/graph_executor/graph_executor.cc Outdated
huajsj and others added 4 commits August 3, 2021 11:23
Co-authored-by: Cody Yu <comaniac0422@gmail.com>
Co-authored-by: Cody Yu <comaniac0422@gmail.com>
Co-authored-by: Cody Yu <comaniac0422@gmail.com>
Co-authored-by: Cody Yu <comaniac0422@gmail.com>

@comaniac comaniac left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@tkonolige

Copy link
Copy Markdown
Contributor

@huajsj Could you also add this to the VM api?

@huajsj

huajsj commented Aug 3, 2021

Copy link
Copy Markdown
Contributor Author

@huajsj Could you also add this to the VM api?

@tkonolige, thanks for the comments, how about I use a separate PR to address this VM support issue?

@tkonolige

Copy link
Copy Markdown
Contributor

@huajsj Totally fine, I don't want to block this PR. It just would be nice to have the api be the same between the graph runtime and the vm.

@huajsj

huajsj commented Aug 3, 2021

Copy link
Copy Markdown
Contributor Author

@tkonolige, thanks for the follow up, sure, would do that.

@masahi masahi merged commit 9dfcb22 into apache:main Aug 4, 2021
mehrdadh pushed a commit to mehrdadh/tvm that referenced this pull request Aug 11, 2021
* [Runtime] Add graph_executor get_input_index API.

In graph_executor use case, user can use set_input with
input index to set input parameter, but there is no straight
forward way to get correct index number with input name, here
provide get_input_index API to do such work.

* Update python/tvm/contrib/graph_executor.py

Co-authored-by: Cody Yu <comaniac0422@gmail.com>

* Update python/tvm/contrib/graph_executor.py

Co-authored-by: Cody Yu <comaniac0422@gmail.com>

* Update src/runtime/graph_executor/graph_executor.cc

Co-authored-by: Cody Yu <comaniac0422@gmail.com>

* Update python/tvm/contrib/graph_executor.py

Co-authored-by: Cody Yu <comaniac0422@gmail.com>

Co-authored-by: Cody Yu <comaniac0422@gmail.com>
@Lyken17

Lyken17 commented Aug 19, 2021

Copy link
Copy Markdown
Contributor

Hi there,

It seems this commit introduces bugs when tunning models on raspberry pis. When I follow the example on auto-scheduler-tune-network-arm, I got following errors

Upload...
Traceback (most recent call last):
  File "pi_bench/tune_mbv2.py", line 143, in <module>
    tune_and_evaluate()
  File "pi_bench/tune_mbv2.py", line 126, in tune_and_evaluate
    module = graph_executor.GraphModule(rlib["default"](dev))
  File "/home/ligeng/Workspace/tvm/python/tvm/contrib/graph_executor.py", line 160, in __init__
    self._get_input_index = module["get_input_index"]
  File "/home/ligeng/Workspace/tvm/python/tvm/runtime/module.py", line 107, in __getitem__
    return self.get_function(name)
  File "/home/ligeng/Workspace/tvm/python/tvm/runtime/module.py", line 91, in get_function
    raise AttributeError("Module has no function '%s'" % name)
AttributeError: Module has no function 'get_input_index'

After I comment the 160th line in python/tvm/contrib/graph_executor.py, the tutorial runs without problem.

@tkonolige

Copy link
Copy Markdown
Contributor

@Lyken17 Did you rebuild TVM on your raspberry pis? You can get this error when there is a TVM version mismatch between the remote and the host.

@Lyken17

Lyken17 commented Aug 20, 2021

Copy link
Copy Markdown
Contributor

@tkonolige I am using the tvm with commit dbf9ce52d4e4fbcd0c1d44f6c8d05c7774dffe63 (3 days ago) on both of my host and pis.

ylc pushed a commit to ylc/tvm that referenced this pull request Sep 29, 2021
* [Runtime] Add graph_executor get_input_index API.

In graph_executor use case, user can use set_input with
input index to set input parameter, but there is no straight
forward way to get correct index number with input name, here
provide get_input_index API to do such work.

* Update python/tvm/contrib/graph_executor.py

Co-authored-by: Cody Yu <comaniac0422@gmail.com>

* Update python/tvm/contrib/graph_executor.py

Co-authored-by: Cody Yu <comaniac0422@gmail.com>

* Update src/runtime/graph_executor/graph_executor.cc

Co-authored-by: Cody Yu <comaniac0422@gmail.com>

* Update python/tvm/contrib/graph_executor.py

Co-authored-by: Cody Yu <comaniac0422@gmail.com>

Co-authored-by: Cody Yu <comaniac0422@gmail.com>
ylc pushed a commit to ylc/tvm that referenced this pull request Jan 13, 2022
* [Runtime] Add graph_executor get_input_index API.

In graph_executor use case, user can use set_input with
input index to set input parameter, but there is no straight
forward way to get correct index number with input name, here
provide get_input_index API to do such work.

* Update python/tvm/contrib/graph_executor.py

Co-authored-by: Cody Yu <comaniac0422@gmail.com>

* Update python/tvm/contrib/graph_executor.py

Co-authored-by: Cody Yu <comaniac0422@gmail.com>

* Update src/runtime/graph_executor/graph_executor.cc

Co-authored-by: Cody Yu <comaniac0422@gmail.com>

* Update python/tvm/contrib/graph_executor.py

Co-authored-by: Cody Yu <comaniac0422@gmail.com>

Co-authored-by: Cody Yu <comaniac0422@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants