question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

sigmoid_cross_entropy_with_logits does not have `labels` arg

See original GitHub issue

Hello,

I’m having some difficulties getting the example code to execute. I believe the issue stems from a tensorflow versioning delta. I first tried to train a model on the celebA data after setting up a cpu tensorflow docker container from: https://hub.docker.com/r/tensorflow/tensorflow/

When I run

python main.py --dataset celebA --input_height=108 --is_train --is_crop True

I get the following traceback:

Traceback (most recent call last):
  File "main.py", line 96, in <module>
    tf.app.run()
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/platform/app.py", line 43, in run
    sys.exit(main(sys.argv[:1] + flags_passthrough))
  File "main.py", line 76, in main
    sample_dir=FLAGS.sample_dir)
  File "/root/git_repos/DCGAN-tensorflow/model.py", line 71, in __init__
    self.build_model()
  File "/root/git_repos/DCGAN-tensorflow/model.py", line 115, in build_model
    logits=self.D_logits, labels=tf.ones_like(self.D)))
TypeError: sigmoid_cross_entropy_with_logits() got an unexpected keyword argument 'labels'

After looking, I found sigmoid_cross_entropy_with_logits here: https://github.com/tensorflow/tensorflow/blob/cb17d1b0e2b581b5da1d9597b7929ba764749d38/tensorflow/python/ops/nn_impl.py#L99 which shows that it does take a labels arg. However, the version under v0.12.1 does not take this arg which I believe is the error I’m receiving above.

Furthermore, if I try to install the specific version of tensorflow branch that you linked to:

pip install git+https://github.com/tensorflow/tensorflow.git@r0.12

I get the following traceback:

Collecting git+https://github.com/tensorflow/tensorflow.git@r0.12
  Cloning https://github.com/tensorflow/tensorflow.git (to r0.12) to /tmp/pip-oKC0L1-build
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
    IOError: [Errno 2] No such file or directory: '/tmp/pip-oKC0L1-build/setup.py'

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-oKC0L1-build/

Any suggestions on how to get this up and running?

Thanks, Scott

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:13 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
carpedm20commented, Feb 6, 2017

You can use any links in https://github.com/tensorflow/tensorflow#installation like:

pip install -U https://ci.tensorflow.org/view/Nightly/job/nightly-matrix-linux-gpu/TF_BUILD_IS_OPT=OPT,TF_BUILD_IS_PIP=PIP,TF_BUILD_PYTHON_VERSION=PYTHON2,label=gpu-linux/lastSuccessfulBuild/artifact/pip_test/whl/tensorflow_gpu-1.0.0rc1-cp27-none-linux_x86_64.whl
2reactions
ppwwyyxxcommented, Jan 17, 2017

Yes the argument only exist in new version of TensorFlow.

Your command is not the right way to install TensorFlow. Please refer to the documentation: https://github.com/tensorflow/tensorflow#installation . (For this new feature you may need the nightly build)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Only call `sigmoid_cross_entropy_with_logits` with named ...
I have just build my first model using Phyton, Keras and Tensorflow. My model looks like this:
Read more >
tf.nn.sigmoid_cross_entropy_with_logits
Measures the probability error in tasks with two outcomes in which each outcome is independent and need not have a fully certain label....
Read more >
tf.nn.sigmoid_cross_entropy_with_logits | TensorFlow
A Tensor of the same shape as logits with the componentwise logistic losses. Raises: ValueError : If logits and labels do not have...
Read more >
Python Examples of tensorflow.python.ops.nn. ...
A common use case is to have logits of shape `[batch_size, num_classes]` and labels of shape `[batch_size]`. But higher dimensions are supported. Args:...
Read more >
Should the cost function be zero using TensorFlow's ...
I'm building a CNN to make a binary classification (1 or zero). For this, I'm using the cost function sigmoid_cross_entropy_with_logits . But ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found