code: def testMaybeSplitSequenceLengths(self):
      with self.test_session():
          # Test unsplit.
          sequence_length = tf.constant([8, 0, 8], tf.int32)
          num_splits = 4
          total_length = 8
          expected_split_length = np.array(
              [[2, 2, 2, 2], [0, 0, 0, 0], [2, 2, 2, 2]]
          )
          split_length = lstm_utils.maybe_split_sequence_lengths(
              sequence_length, num_splits, total_length
          ).eval()
          self.assertAllEqual(expected_split_length, split_length)
  
          # Test already split.
          presplit_length = np.array(
              [[0, 2, 1, 2], [0, 0, 0, 0], [1, 1, 1, 1]], np.int32
          )
          split_length = lstm_utils.maybe_split_sequence_lengths(
              tf.constant(presplit_length), num_splits, total_length
          ).eval()
          self.assertAllEqual(presplit_length, split_length)
  
          # Test invalid total length.
          with self.assertRaises(tf.errors.InvalidArgumentError):
              sequence_length = tf.constant([8, 0, 7])
              lstm_utils.maybe_split_sequence_lengths(
                  sequence_length, num_splits, total_length
              ).eval()
  
          # Test invalid segment length.
          with self.assertRaises(tf.errors.InvalidArgumentError):
              presplit_length = np.array(
                  [[0, 2, 3, 1], [0, 0, 0, 0], [1, 1, 1, 1]], np.int32
              )
              lstm_utils.maybe_split_sequence_lengths(
                  tf.constant(presplit_length), num_splits, total_length
              ).eval()
  
file_path: magenta/magenta/models/music_vae/lstm_utils_test.py
imports: from magenta.models.music_vae import lstm_utils
  import numpy
  import tensorflow.compat.v1
label_desc: Use image node_id 3 for calling the LstmUtilsTest obj's underlying member method code with example usage: obj.testMaybeSplitSequenceLengths() without return types