title: Tensorflow2.0: How to convert a sparse tensor with rank(st_input) greater than 2 to RaggedTensor?
body: <p>I am reading a text file through Data API and converting the text into TFRecords. When I am reading the records line by line, I am getting a sparse matrix of rank 2 which is easily being transformed into a RaggedTensor by <code>tf.RaggedTensor.from_sparse</code>. However, when I am reading the records in batch of size 10, resulting sparse tensor is of rank 3. In the documentation, it is written that <code>tf.RaggedTensor.from_sparse</code> works only with sparse tensors of rank 2. Is there a way to create RaggedTensors from a sparse tensor of rank 3? I tried <code>tf.sparse.reshape</code> and tried removing the axis=1. This was successful as I was able to print the output. But this seems a little hackish way to do and I am looking for something more tensorflow-ish. An example to reproduce my case is as follows:-</p>
  
  <ol>
  <li><p>When reading tfrecords line by line-<br/></p>
  
  <p><code>indices = array([[ 0,  0],
         [ 0,  1],
         [ 0,  2],
         [ 0,  3],
         [ 0,  4],
         [ 0,  5],
         [ 0,  6],
         [ 0,  7],
         [ 0,  8],
         [ 0,  9],
         [ 0, 10]], dtype=int64)</code><br/>
  <code>values = array([b'What', b'interesting', b'fact', b'about', b'India', b'can',
         b'you', b'add', b'to', b'my', b'knowledge?'], dtype=object)</code><br/>
  <code>dense_shape=array([ 1, 11], dtype=int64)</code><br/><br/>
  <code>tf.RaggedTensor.from_sparse(tf.SparseTensor(indices=indices,values=values,dense_shape=dense_shape))</code> </p></li>
  </ol>
  
  <p><br/>gives<br/></p>
  
  <pre><code>`&lt;tf.RaggedTensor [[b'What', b'interesting', b'fact', b'about', b'India', b'can', b'you', b'add', b'to', b'my', b'knowledge?']]&gt;`
  </code></pre>
  
  <p><br/><br/>
  2. When reading a batch of size 1 (actual batch size was 10 but that would become way too cumbersome):<br/></p>
  
  <pre><code>`indices=array([[ 0,  0,  0],
         [ 0,  0,  1],
         [ 0,  0,  2],
         [ 0,  0,  3],
         [ 0,  0,  4],
         [ 0,  0,  5],
         [ 0,  0,  6],
         [ 0,  0,  7],
         [ 0,  0,  8],
         [ 0,  0,  9],
         [ 0,  0, 10]], dtype=int64)`&lt;br/&gt;
  `values=array([b'What', b'interesting', b'fact', b'about', b'India', b'can',
         b'you', b'add', b'to', b'my', b'knowledge?'], dtype=object)`&lt;br/&gt;
  `dense_shape=array([ 1,  1, 11], dtype=int64)`&lt;br/&gt;&lt;br/&gt;
  `tf.RaggedTensor.from_sparse(tf.SparseTensor(indices=indices,values=values,dense_shape=dense_shape))`
  </code></pre>
  
  <p><br/>gives an error message<br/></p>
  
  <pre><code>`ValueError: rank(st_input) must be 2`
  </code></pre>
  
  <p><br/>
  However, using the statement<br/>
  <code>tf.sparse.reshape(tf.SparseTensor(indices=indices,values=values,dense_shape=dense_shape),shape=[1,11])</code> <br/>resolves this issue.</p>
  
  <p>Apologies for the sloppy editing.</p>