Vlad B
Vlad B

Reputation: 35

ValueError: Only call `softmax_cross_entropy_with_logits` with named arguments (labels=..., logits=..., ...) error

The error is ValueError:

Only call softmax_cross_entropy_with_logits with named arguments (labels=..., logits=..., ...).

The code is https://github.com/drvladb/stackoverflow/blob/master/code.py.

It is run in Python 3.5.2 with tensorflow 1.8 and numpy 1.13.3. I have tried using different versions of python and tensorflow and on a docker and anaconda but no avail.

Can I please get some help with fixing it?

Upvotes: 1

Views: 210

Answers (1)

Arount
Arount

Reputation: 10403

The only line making reference to softmax_cross_entropy_with_logits in your code is line 206, so I will assume it's where you got your error.

The error message is kind of explicit, you need to use named arguments (or keywords arguments) with the method softmax_cross_entropy_with_logits.

So, I guess you want something like:

softmax_cross_entropy_with_logits(labels=self.one_hot_y, logits=self.logits)

Upvotes: 1

Related Questions