Exemple #1
0
 def testFillArrayLarge(self):
     a = (np.ones(shape=[8, 8, 8, 8, 32], dtype=np.int32).tolist() +
          np.ones(shape=[8, 8, 8, 8, 36], dtype=np.int32).tolist())
     actual = np.ones(shape=[16, 8, 8, 8, 36], dtype=np.int32)
     ff._fill_array(actual, a)
     expected = np.ones(shape=[16, 8, 8, 8, 36], dtype=np.int32)
     expected[:8, ..., 32:] = 0
     self.assertEqual(expected.tolist(), actual.tolist())
Exemple #2
0
 def testFillArraySmall(self):
     a = (np.ones(shape=[32, 32], dtype=np.int32).tolist() +
          np.ones(shape=[32, 36], dtype=np.int32).tolist())
     actual = np.ones(shape=[64, 36], dtype=np.int32)
     ff._fill_array(actual, a)
     expected = np.ones(shape=[64, 36], dtype=np.int32)
     expected[:32, 32:] = 0
     self.assertEqual(expected.tolist(), actual.tolist())
Exemple #3
0
 def testFillArrayLargeWithSpecifiedValue(self):
     fill_value = 8
     a = (np.ones(shape=[8, 8, 8, 8, 32], dtype=np.int32).tolist() +
          np.ones(shape=[8, 8, 8, 8, 36], dtype=np.int32).tolist())
     actual = np.ones(shape=[16, 8, 8, 8, 36], dtype=np.int32)
     ff._fill_array(actual, a, fill_value)
     expected = np.ones(shape=[16, 8, 8, 8, 36], dtype=np.int32)
     expected[:8, ..., 32:] = fill_value
     self.assertEqual(expected.tolist(), actual.tolist())