完整报错:
TypeError: Failed to convert object of type <class 'tensorflow.python.framework.sparse_tensor.SparseTensor'> to Tensor. Contents: SparseTensor(indices=Tensor("DeserializeSparse:0", shape=(?, 2), dtype=int64, device=/device:GPU:*), values=Tensor("DeserializeSparse:1", shape=(?,), dtype=int64, device=/device:GPU:*), dense_shape=Tensor("DeserializeSparse:2", shape=(2,), dtype=int64, device=/device:GPU:*)). Consider casting elements to a supported type.
原因:
这个placeholder定义是
tf.placeholder(tf.int64, shape=[batch_size, 100])
但训练时传入的每个值长度不一,有100长度,有50长度