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

TypeError: unsupported operand type(s) for /: 'Dimension' and 'int' #36

Open
ahwhbc opened this issue Jul 12, 2019 · 5 comments
Open

TypeError: unsupported operand type(s) for /: 'Dimension' and 'int' #36

ahwhbc opened this issue Jul 12, 2019 · 5 comments

Comments

@ahwhbc
Copy link

ahwhbc commented Jul 12, 2019

I run the code test_pgn.py ,but I come across this problem TypeError: unsupported operand type(s) for /: 'Dimension' and 'int'

@leo19980219
Copy link

I get the same issue.
I change shape=[k_h, k_w, c_i / group, c_o] to shape=[k_h, k_w, int(c_i) / group, c_o]
and it work fine for me.

@finde
Copy link

finde commented Sep 3, 2019

True.
Or, you can use .as_list() for example c_i = input.get_shape().as_list()[-1] for the c_i

@MuhammadAsadJaved
Copy link

@leo19980219 @finde
I make changes as you said and it resolved this issue but now it throw another error.

File "test_pgn.py", line 112, in main
for xx in xrange(14):
NameError: name 'xrange' is not defined

@MuhammadAsadJaved
Copy link

I have resolved this issue. It's because python version difference. xrange() is function in python 2.x which can be replaced with range() if you are using python 3.x. so just replace xrange() with range().

This was referenced Dec 5, 2019
@dveersingh
Copy link

I run the code test_pgn.py ,but I come across this problem TypeError: unsupported operand type(s) for /: 'Dimension' and 'int'

replace / to //

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

5 participants