class_docstr: Tests shape-related utility functions.
      
docstr: Tests :func:`texar.tf.utils.shapes.varlength_roll`.
code: def test_varlength_roll(self):
      """
      Tests :func:`texar.tf.utils.shapes.varlength_roll`.
      """
      # 2D
      x = np.asarray(
          [[1, 1, 0, 0], [1, 0, 0, 0], [1, 1, 1, 1]], dtype=np.int32
      )
      x_length = [-2, -1, -4]
      z = shapes.varlength_roll(x, x_length)
  
      with self.test_session() as sess:
          z_ = sess.run(z)
  
          z_true = np.asarray(
              [[0, 0, 1, 1], [0, 0, 0, 1], [1, 1, 1, 1]], dtype=np.int32
          )
  
          np.testing.assert_array_equal(z_, z_true)
  
      # 3D
      x = np.asarray(
          [
              [[1], [1], [0], [0]],
              [[1], [0], [0], [0]],
              [[1], [1], [1], [1]],
          ],
          dtype=np.int32,
      )
      x_length = [-2, -1, -4]
      z = shapes.varlength_roll(x, x_length)
  
      with self.test_session() as sess:
          z_ = sess.run(z)
  
          z_true = np.asarray(
              [
                  [[0], [0], [1], [1]],
                  [[0], [0], [0], [1]],
                  [[1], [1], [1], [1]],
              ],
              dtype=np.int32,
          )
  
          np.testing.assert_array_equal(z_, z_true)
  
file_path: texar/tests/utils/shapes_test.py
imports: import numpy
  import tensorflow
  from texar.tf.utils import shapes
label_desc: Use image node_id 5 for calling the ShapesTest obj's underlying member method code with example usage: obj.test_varlength_roll() without return types