From 321cae2cfe5a6dbba924a47e91ae47e0d9826794 Mon Sep 17 00:00:00 2001 From: Tristan Konolige Date: Mon, 20 Jul 2020 10:15:29 -0600 Subject: [PATCH] Raise error if key cannot be found in graph runtime inputs --- python/tvm/contrib/graph_runtime.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/python/tvm/contrib/graph_runtime.py b/python/tvm/contrib/graph_runtime.py index 326eccb674a59..22d0a8b8bc1de 100644 --- a/python/tvm/contrib/graph_runtime.py +++ b/python/tvm/contrib/graph_runtime.py @@ -152,7 +152,10 @@ def set_input(self, key=None, value=None, **params): Additional arguments """ if key is not None: - self._get_input(key).copyfrom(value) + v = self._get_input(key) + if v is None: + raise RuntimeError("Could not find '%s' in graph's inputs" % key) + v.copyfrom(value) if params: # upload big arrays first to avoid memory issue in rpc mode