From 7d8d7910505886761851ca88c63915153f028d81 Mon Sep 17 00:00:00 2001 From: LiuChiaChi <709153940@qq.com> Date: Sun, 27 Sep 2020 11:40:02 +0000 Subject: [PATCH] fix Model bugs, because inputs can be list or dict when it is provided. --- python/paddle/hapi/model.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/python/paddle/hapi/model.py b/python/paddle/hapi/model.py index 936bc77d491..ef06e7e0b5b 100644 --- a/python/paddle/hapi/model.py +++ b/python/paddle/hapi/model.py @@ -858,7 +858,10 @@ class Model(object): raise TypeError( "'inputs' must be list or dict, and couldn't be None.") elif inputs: - self._shapes = [list(input.shape) for input in inputs] + if isinstance(inputs, list): + self._shapes = [list(input.shape) for input in inputs] + elif isinstance(inputs, dict): + self._shapes = [list(inputs[name]) for name in inputs] self._inputs = self._verify_spec(inputs, is_input=True) self._labels = self._verify_spec(labels) -- GitLab