diff --git a/python/paddle_serving_client/__init__.py b/python/paddle_serving_client/__init__.py index 3b73c568c930a01d9d30f900f61ad0568b102396..e62fb0e92ef5135ff46c642964d1283c94248b02 100644 --- a/python/paddle_serving_client/__init__.py +++ b/python/paddle_serving_client/__init__.py @@ -446,14 +446,12 @@ class MultiLangClient(object): v_type = self.feed_types_[name] if v_type == 0: # int64 if isinstance(var, np.ndarray): - tensor.int64_data.extend( - self._flatten_list(var.tolist())) + tensor.int64_data.extend(var.reshape(-1).tolist()) else: tensor.int64_data.extend(self._flatten_list(var)) elif v_type == 1: # float32 if isinstance(var, np.ndarray): - tensor.float_data.extend( - self._flatten_list(var.tolist())) + tensor.float_data.extend(var.reshape(-1).tolist()) else: tensor.float_data.extend(self._flatten_list(var)) else: diff --git a/python/paddle_serving_server/__init__.py b/python/paddle_serving_server/__init__.py index 86b8076a378544699d5ae9715695dde3acbe8aa4..8dcbcefc4881531cc66ab289124aab70697278b2 100644 --- a/python/paddle_serving_server/__init__.py +++ b/python/paddle_serving_server/__init__.py @@ -513,11 +513,9 @@ class MultiLangServerService( tensor = multi_lang_general_model_service_pb2.Tensor() v_type = self.fetch_types_[name] if v_type == 0: # int64 - tensor.int64_data.extend( - self._flatten_list(result[name].tolist())) + tensor.int64_data.extend(result[name].reshape(-1).tolist()) elif v_type == 1: # float32 - tensor.float_data.extend( - self._flatten_list(result[name].tolist())) + tensor.float_data.extend(result[name].reshape(-1).tolist()) else: raise Exception("error type.") tensor.shape.extend(list(result[name].shape))