Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple infer output must have the same size ? #2170

Closed
pengwangucla opened this issue May 16, 2017 · 7 comments
Closed

Multiple infer output must have the same size ? #2170

pengwangucla opened this issue May 16, 2017 · 7 comments
Assignees

Comments

@pengwangucla
Copy link
Collaborator

pengwangucla commented May 16, 2017

related to issue #2107 In paddle.infer, it concatenate different output of the same field as follow:

    def infer(self, input, field='value', **kwargs):
        """
        Infer a data by model.
        :param input: input data batch. Should be python iterable object.
        :param field: output field.
        """
        retv = None
        kwargs['input'] = input
        for result in self.iter_infer_field(field=field, **kwargs):
            if retv is None:
                retv = [[] for i in xrange(len(result))]
            for i, item in enumerate(result):
                retv[i].append(item)
  >      retv = [numpy.concatenate(out) for out in retv]
        if len(retv) == 1:
            return retv[0]
        else:
            return retv

Why you need to concatenate it ? Can it be done with a 2 d list or a list of dictionary ? So that you don't need to require the shape of each output to be exactly the same ?

@reyoung

@lcy-seso lcy-seso self-assigned this May 17, 2017
@lcy-seso
Copy link
Contributor

I have met the same problem. I will try to fix this.

@wangkuiyi wangkuiyi assigned lcy-seso and unassigned lcy-seso May 17, 2017
@juliecbd
Copy link

Any update on this? I have met the same problem

@juliecbd
Copy link

juliecbd commented Jun 27, 2017

I remember I was able to input numpy nd array as input, and it no longer works. I get

/py_paddle/dataprovider_converter.py", line 112, in pre_scan
    self.__dim__ = reduce(lambda x, y: x * y, self.__shape__)
TypeError: reduce() of empty sequence with no initial value

Error

@lcy-seso
Copy link
Contributor

lcy-seso commented Jun 27, 2017

Hi, @juliecbd Another user has reported the same bug: #2564. This hasn't been fixed yet... Sorry.

@juliecbd
Copy link

juliecbd commented Jun 27, 2017 via email

@lcy-seso
Copy link
Contributor

@juliecbd I will look into this, Thank you.

@JiayiFeng
Copy link
Collaborator

Close this issue for related PR has been closed. Please feel free to reopen it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants