예제 #1
0
 def test_padding_reverse_causal(self):
   a = pad.create_from_padfn(pad.reverse_causal, 4, 3, 2)
   self.assertEqual(a, ((0, 9), (0, 9)))
예제 #2
0
 def test_padding_full(self):
   a = pad.create_from_padfn(pad.full, 4, 3, 2)
   self.assertEqual(a, ((9, 9), (9, 9)))
예제 #3
0
 def test_padding_causal(self):
   a = pad.create_from_padfn(pad.causal, 4, 3, 2)
   self.assertEqual(a, ((9, 0), (9, 0)))
예제 #4
0
 def test_padding_same(self):
   a = pad.create_from_padfn(pad.same, 4, 3, 2)
   self.assertEqual(a, ((4, 5), (4, 5)))
예제 #5
0
 def test_padding_valid(self):
   a = pad.create_from_padfn(pad.valid, 4, 3, 2)
   self.assertEqual(a, ((0, 0), (0, 0)))
예제 #6
0
 def test_padding_incorrect_input(self, kernel_size, rate):
   with self.assertRaisesRegex(
       TypeError,
       r"must be a scalar or sequence of length 1 or sequence of length 3."):
     pad.create_from_padfn(pad.full, kernel_size, rate, 3)
예제 #7
0
 def test_padding_3d(self):
   a = pad.create_from_padfn((pad.causal, pad.full, pad.full), (3, 2, 3), (1),
                             3)
   self.assertEqual(a, ((2, 0), (1, 1), (2, 2)))
예제 #8
0
 def test_padding_1d(self):
   a = pad.create_from_padfn(pad.full, 3, 1, 1)
   self.assertEqual(a, ((2, 2),))