1
のTensorflow DNNモデルを使用しています。Tensorflow分類ラベルのデータタイプ
数値入力(float32)ですが、文字列タイプの出力です。
x = tf.placeholder("float", [None, n_input])
y = tf.placeholder(tf.string, [None, n_classes])
私は以下のように損失とオプティマイザを定義しよう:
cost = tf.reduce_mean(tf.nn.softmax_cross_entropy_with_logits(logits=pred, labels=y))
私はhereから文書を見上げ
TypeError: sigmoid_cross_entropy_with_logits() got an unexpected keyword argument 'labels'
というエラーが発生し、それが
と言いましたlogits and targets must have the same type and shape.
クラスを浮動小数点数に変換する必要がありますか?
output_y = [["apple", "apple", "orange", "banana"]]
encoded_y = [[1], [1], [2], [3]]