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

reduce_sum() function does not recognize 2nd argument 'axis' #186

Closed
kyungyunlee opened this issue Jun 30, 2017 · 5 comments
Closed

reduce_sum() function does not recognize 2nd argument 'axis' #186

kyungyunlee opened this issue Jun 30, 2017 · 5 comments

Comments

@kyungyunlee
Copy link

kyungyunlee commented Jun 30, 2017

There seems to be an issue in reduce_sum() function in lab-06-1-softmax_classifier.py

When the second argument is "axis=1", there is a TypeError saying "unexpected keyword argument."
From my experience with python, this shouldn't be an error, but I am not sure if it is a version issue(I have the most recent one though..) or something else.

screen shot 2017-06-30 at 11 41 35 am

In my case, it works when I fix it from
cost = tf.reduce_mean(-tf.reduce_sum(Y * tf.log(hypothesis), axis=1))
to
cost = tf.reduce_mean(-tf.reduce_sum(Y * tf.log(hypothesis), 1))

Also a reference to tensorflow document.
https://www.tensorflow.org/api_docs/python/tf/reduce_sum

@kkweon
Copy link
Collaborator

kkweon commented Jun 30, 2017

I'm not able to reproduce this error. You should be able to use the axis keyword.
Also, it's not a version issue because axis has been there since the beginning.

The only thing I suspect is that you claim there is an issue in the file lab-06-1-softmax_classifier.py
but your error message shows the error happens in basics-01.py which is not relevant to this file.

It seems like a sementic error to me.

@kyungyunlee
Copy link
Author

I am very sorry about the file name and the confusion. I made my own file without cloning directly from git to try out different codes myself, so I was actually running the correct file lab-06-1-softmax_classifier.py and code. I also think that axis keyword should work, but it only works when written without...

Just wondering if it could help...I am using python3 with tensorflow '0.11.0rc2'
screen shot 2017-07-03 at 12 52 02 am

Any idea/suggestion/lesson! would be appreciated!!
Thanks

@kkweon
Copy link
Collaborator

kkweon commented Jul 2, 2017

@kyungyunlee You are using too old version of tensorflow.
The current version is 1.2.1 and yours is 0.11.0 and even it's a rc(release candidate).

Please update your tensorflow first.

tfversion

@kyungyunlee
Copy link
Author

@kkweon
I tried uninstalling and reinstall tensorflow with pip3 multiple times in the past, but it still remained the same, so I was very ignorant about it for a while.
But I just realized that I was using python3.5(default) for running tensorflow but was updating tensorflow for python3.6...
And it solved several problems actually, thank you very very much!

@kkweon
Copy link
Collaborator

kkweon commented Jul 3, 2017

Great!

@kkweon kkweon closed this as completed Jul 3, 2017
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