This warning is printed when a sparse tf.IndexedSlices
object is implicitly converted to a dense tf.Tensor
. This typically happens when one op (usually tf.gather()
) backpropagates a sparse gradient, but the op that receives it does not have a specialized gradient function that can handle sparse gradients. As a result, TensorFlow automatically densifies the tf.IndexedSlices
, which can have a devastating effect on performance if the tensor is large.
To fix this problem, you should try to ensure that the params
input to tf.gather()
(or the params
inputs to tf.nn.embedding_lookup()
) is a tf.Variable
. Variables can receive the sparse updates directly, so no conversion is needed. Although tf.gather()
(and tf.nn.embedding_lookup()
) accept arbitrary tensors as inputs, this may lead to a more complicated backpropagation graph, resulting in implicit conversion.