Skip to content

TypeError: unsupported operand type(s) for +: "int" and "NoneType" while run python train.py #1

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

Closed
happylicio opened this issue Oct 25, 2016 · 3 comments

Comments

@happylicio
Copy link

happylicio commented Oct 25, 2016

My way to solve this TypeError is rewriting the function of get_output_shape_for in Class ConCatLayer, compatibility with summarizing while None in sizes . But rewriting package's function seems a little tricky. @hjweide , how did you do?

@happylicio happylicio changed the title TypeError: unsupported operand type(s) for +: "int" and "NoneType" TypeError: unsupported operand type(s) for +: "int" and "NoneType" while run python train.py Oct 25, 2016
@hjweide
Copy link
Owner

hjweide commented Oct 25, 2016

@happylicio, I'm afraid I don't entirely understand what you're asking. Running python train.py works for me using the latest versions of Lasagne and Theano. Could you please provide steps to reproduce this issue, perhaps with some terminal output?

@happylicio
Copy link
Author

I'm sorry for not noting your reply timely. The following picture addresses the TypeError when I firstly run your code python train.py.
image
According to the Traceback, the error case is like sum([None, None, ...]). So I rewrite the code in lasagne/layers/merge.py and successfully run your code. But this way is a little tricky cause rewriting lasagne library code. I just wanna whether you have the same problem and your way to solving it.
BTW, your blog and implementation adversarial-autoencoder are an awesome work and help me a lot.

@hjweide
Copy link
Owner

hjweide commented Nov 22, 2016

Are you perhaps using an old version of Lasagne? You'll notice that the ConcatLayer already deals with None in the input shape:

# Infer output shape on concatenation axis and return
sizes = [input_shape[self.axis] for input_shape in input_shapes]
concat_size = None if any(s is None for s in sizes) else sum(sizes)
output_shape[self.axis] = concat_size
return tuple(output_shape)

Also, thank you, I'm glad to hear that my code was useful to you :)

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

2 participants