예제 #1
0
 def test_mod(self):
     arr = np.arange(1, 5).reshape([2, 2])
     t = pt.from_array(arr)
     t1 = pt.tensor([2, 2], pt.dense)
     i, j = pt.get_index_vars(2)
     t1[i, j] = pt.remainder(t[i, j], 2)
     self.assertEqual(t1, arr % 2)
예제 #2
0
 def test_reduce(self):
     arr = np.arange(1, 5).reshape([2, 2])
     t = pt.from_array(arr)
     res = pt.tensor()
     i, j = pt.get_index_vars(2)
     res[None] = pt.sum(j, pt.sum(i, t[i, j]))
     self.assertEqual(res[0], np.sum(arr))