예제 #1
0
 def test_iterator(self):
     length, patch_size, strides = 8, 1, 1
     output = [
         offset for offset in utt.offset_1d(length, patch_size, strides)
     ]
     expected = list(xrange(8))
     self.assertTrue(output == expected, msg=utg.errmsg(output, expected))
예제 #2
0
 def test_basic_2(self):
     length, patch_size, strides = 4, 2, 2
     output = [
         offset for offset in utt.offset_1d(length, patch_size, strides)
     ]
     expected = [0, 2]
     self.assertTrue(output == expected, msg=utg.errmsg(output, expected))
예제 #3
0
 def test_basic(self):
     """A basic use case of offset_1d"""
     length, patch_size, strides = 16, 4, 4
     output = [
         offset for offset in utt.offset_1d(length, patch_size, strides)
     ]
     expected = [0, 4, 8, 12]
     self.assertTrue(output == expected, msg=utg.errmsg(output, expected))
예제 #4
0
 def test_non_multiple(self):
     """A use case when length is not a multiple of strides"""
     length, patch_size, strides = 17, 4, 4
     output = [
         offset for offset in utt.offset_1d(
             length, patch_size, strides, check_all=True)
     ]
     expected = [0, 4, 8, 12, 13]
     self.assertTrue(output == expected, msg=utg.errmsg(output, expected))
예제 #5
0
 def test_offset1(self):
     """A use case when length is not a multiple of strides"""
     length, patch_size, strides = 16, 8, 4
     offset1 = 4
     output = [
         offset for offset in utt.offset_1d(
             length, patch_size, strides, offset1=offset1)
     ]
     expected = [0, 4]
     self.assertTrue(output == expected, msg=utg.errmsg(output, expected))