kimber-chen/Tensorflow-for-stock-prediction

ValueError: Only call `sparse_softmax_cross_entropy_with_logits` with named arguments

Opened this issue · 0 comments


ValueError Traceback (most recent call last)
in ()
81 tf.nn.l2_loss(W_fc2) + tf.nn.l2_loss(b_fc2))
82
---> 83 loss = tf.nn.sparse_softmax_cross_entropy_with_logits(h_fc2,y_)
84 cost = tf.reduce_sum(loss) / batch_size
85 cost += regularization*regularizers

/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/nn_ops.pyc in sparse_softmax_cross_entropy_with_logits(_sentinel, labels, logits, name)
1848 """
1849 _ensure_xent_args("sparse_softmax_cross_entropy_with_logits", _sentinel,
-> 1850 labels, logits)
1851
1852 # TODO(pcmurray) Raise an error when the label is not an index in

/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/nn_ops.pyc in _ensure_xent_args(name, sentinel, labels, logits)
1696 if sentinel is not None:
1697 raise ValueError("Only call %s with "
-> 1698 "named arguments (labels=..., logits=..., ...)" % name)
1699 if labels is None or logits is None:
1700 raise ValueError("Both labels and logits must be provided.")

ValueError: Only call sparse_softmax_cross_entropy_with_logits with named arguments (labels=..., logits=..., ...)