Ejemplo n.º 1
0
 def test_sparse_pianoroll_to_dense_subtracts_min_note(self):
     sparse_pianoroll = [(4, 5), (5, 4), (), (5, ), (), ()]
     dense_pianoroll, num_timesteps = datasets.sparse_pianoroll_to_dense(
         sparse_pianoroll, min_note=4, num_notes=2)
     self.assertEqual(num_timesteps, 6)
     self.assertAllEqual([[1, 1], [1, 1], [0, 0], [0, 1], [0, 0], [0, 0]],
                         dense_pianoroll)
Ejemplo n.º 2
0
 def test_sparse_pianoroll_to_dense_empty_at_end(self):
     sparse_pianoroll = [(0, 1), (1, 0), (), (1, ), (), ()]
     dense_pianoroll, num_timesteps = datasets.sparse_pianoroll_to_dense(
         sparse_pianoroll, min_note=0, num_notes=2)
     self.assertEqual(num_timesteps, 6)
     self.assertAllEqual([[1, 1], [1, 1], [0, 0], [0, 1], [0, 0], [0, 0]],
                         dense_pianoroll)
Ejemplo n.º 3
0
 def test_sparse_pianoroll_to_dense_simple(self):
     sparse_pianoroll = [(0, ), (), (1, )]
     dense_pianoroll, num_timesteps = datasets.sparse_pianoroll_to_dense(
         sparse_pianoroll, min_note=0, num_notes=2)
     self.assertEqual(num_timesteps, 3)
     self.assertAllEqual([[1, 0], [0, 0], [0, 1]], dense_pianoroll)