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

forward_all() not working in python 3 #3609

Open
enedene opened this issue Jan 28, 2016 · 2 comments
Open

forward_all() not working in python 3 #3609

enedene opened this issue Jan 28, 2016 · 2 comments

Comments

@enedene
Copy link

enedene commented Jan 28, 2016

I have a caffe with python 3 interface installed. When trying to use:

solver.net.forward_all() I get the following error:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-341-419dfac25475> in <module>()
----> 1 solver.net.forward_all()

/root/caffe/python/caffe/pycaffe.py in _Net_forward_all(self, blobs, **kwargs)
    173     # Collect outputs from batches
    174     all_outs = {out: [] for out in set(self.outputs + (blobs or []))}
--> 175     for batch in self._batch(kwargs):
    176         outs = self.forward(blobs=blobs, **batch)
    177         for out, out_blob in outs.iteritems():

/root/caffe/python/caffe/pycaffe.py in _Net_batch(self, blobs)
    257     batch: {blob name: list of blobs} dict for a single batch.
    258     """
--> 259     num = len(blobs.itervalues().next())
    260     batch_size = self.blobs.itervalues().next().num
    261     remainder = num % batch_size

AttributeError: 'dict' object has no attribute 'itervalues'

values() dict method should be used for python 3 instead. It's possible that this is not the only place where this error occurs.

@seanbell
Copy link

I suppose the fix is to use six to abstract away the 2vs3 issues, in cases like this.

@kruupos
Copy link

kruupos commented Mar 1, 2016

This is already have been taken care of #3716

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

No branches or pull requests

3 participants