x = tf.keras.Input(shape=(32,), sparse=True)
y = tf.keras.layers.Dense(1, activation='sigmoid')(x)
model = tf.keras.Model(x, y)
ValueError: The last dimension of the inputs to `Dense` should be defined. Found `None`.
>>> x = tf.keras.Input(shape=(32,), sparse=True, batch_size=1)
>>> y = tf.keras.layers.Dense(1, activation='sigmoid')(x)
I tried to execute the above line but it's still giving conversion error from SparseTensor to Tensor.
TypeError: Failed to convert object of type <class 'tensorflow.python.framework.sparse_tensor.SparseTensor'> to Tensor. Contents: SparseTensor(indices=Tensor("input_7/indices:0", shape=(?, 2), dtype=int64), values=Tensor("input_7/values:0", shape=(?,), dtype=float32), dense_shape=Tensor("input_7/shape:0", shape=(2,), dtype=int64)). Consider casting elements to a supported type.
--
You received this message because you are subscribed to the Google Groups "Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to discuss+u...@tensorflow.org.
To view this discussion on the web visit https://groups.google.com/a/tensorflow.org/d/msgid/discuss/2b6832f9-d8dd-48b7-a3b6-b005eea1dd57%40tensorflow.org.