提交 cadabe1d 编写于 作者: T Tao Luo 提交者: GitHub

Update inference.py

上级 ac843bb8
......@@ -37,16 +37,15 @@ class Inference(object):
self.__gradient_machine__.finish()
def iter_infer_field(self, field, **kwargs):
for result in self.iter_infer(**kwargs):
yield [
each_result[each_field]
for each_result in result for each_field in field
]
def infer(self, field='value', **kwargs):
if not isinstance(field, list) and not isinstance(field, tuple):
field = [field]
for result in self.iter_infer(**kwargs):
for each_result in result:
item = [each_result[each_field] for each_field in field]
yield item
def infer(self, field='value', **kwargs):
retv = None
for result in self.iter_infer_field(field=field, **kwargs):
if retv is None:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册