From 31a8d7605231fbcf9aa9c3632686cd90e97adb4b Mon Sep 17 00:00:00 2001 From: Zhi <5145158+zhiics@users.noreply.github.com> Date: Wed, 24 Jul 2019 10:13:16 -0700 Subject: [PATCH] [Relay][vm] Small bug fix for DataTypeObject (#3604) * small bug fix for DataTypeObject * retrigger ci --- python/tvm/relay/backend/vmobj.py | 2 +- tests/python/relay/test_vm.py | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/python/tvm/relay/backend/vmobj.py b/python/tvm/relay/backend/vmobj.py index d6b11604fb8b..4c92e9bf38a6 100644 --- a/python/tvm/relay/backend/vmobj.py +++ b/python/tvm/relay/backend/vmobj.py @@ -85,7 +85,7 @@ def __getitem__(self, idx): return self.fields[idx] def __len__(self): - return self.num_fields + return len(self.fields) def __iter__(self): return iter(self.fields) diff --git a/tests/python/relay/test_vm.py b/tests/python/relay/test_vm.py index 706c8587596a..fbb6ce55d0b9 100644 --- a/tests/python/relay/test_vm.py +++ b/tests/python/relay/test_vm.py @@ -213,6 +213,9 @@ def test_list_constructor(): mod["main"] = f result = veval(mod) + assert len(result) == 2 + assert len(result[1]) == 2 + obj = vmobj_to_list(result) tvm.testing.assert_allclose(obj, np.array([3,2,1]))