Skip to content

Client端输入类型为list时,需要展平成一维,不然无法通过shape检查 #672

Closed
@barrierye

Description

@barrierye

#625 中,用户通过HTTP方式发送 image.reshape(1, 28, 28).tolist() 数据,但因为没有通过shape检查导致预测失败。

Client中shape检查的相关代码:

218     def shape_check(self, feed, key):
219         if key in self.lod_tensor_set:
220             return
221         if isinstance(feed[key],
222                       list) and len(feed[key]) != self.feed_tensor_len[key]:
223             raise ValueError("The shape of feed tensor {} not match.".format(
224                 key))
225         if type(feed[key]).__module__ == np.__name__ and np.size(feed[
226                 key]) != self.feed_tensor_len[key]:
227             #raise SystemExit("The shape of feed tensor {} not match.".format(
228             #    key))
229             pass

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions