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

inception_score.py: fixed the issue of ValueError "Cannot iterate over a shape with unknown rank" #81

Open
China-LiuXiaopeng opened this issue Nov 16, 2018 · 0 comments

Comments

@China-LiuXiaopeng
Copy link

China-LiuXiaopeng commented Nov 16, 2018

The inception_scope.py in the tf version =1.11.0 (python 3.6) works well for me. But when I run it in another machine with tf version=1.8.0 (python 3.5), it reports a ValueError "Cannot iterate over a shape with unknown rank" occurring in the code here:

def _inception_score(self):  
    ....
    for o in op.outputs:  
        shape = o.get_shape()  
        shape = [s.value for s in shape]. # error raised

I observed that the problem is perhaps caused by various Tensor type of o, which is with both tf.float32 and tf.bool. However, the bool type of o has the shape of [ ], which could not be correctly executed by the iteration s.value for s in shape iteration, therefore a ValueError raising! We could fix it by the following modifications:

def _inception_score(self):`
    ....
    for o in op.outputs:
        if o.dtype == tf.bool:
            shape = []
        else:
            shape = [s.value for s in o.shape]
@China-LiuXiaopeng China-LiuXiaopeng changed the title inception score computing: fixed the issue of "Cannot iterate over a shape with unknown rank" inception_score.py: fixed the issue of ValueError "Cannot iterate over a shape with unknown rank" Nov 16, 2018
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

1 participant