Ejemplo n.º 1
0
 def testMasked_scatter_braodcasting2(self):
     t = TensorBase(np.ones((2, 3)))
     source = TensorBase([1, 2, 3, 4, 5, 6])
     mask = TensorBase([[1], [0]])
     t.masked_scatter_(mask, source)
     self.assertTrue(np.array_equal(t, TensorBase([[1, 2, 3], [1, 1, 1]])))
Ejemplo n.º 2
0
 def testMasked_scatter_1(self):
     t = TensorBase(np.ones((2, 3)))
     source = TensorBase([1, 2, 3, 4, 5, 6])
     mask = TensorBase([[0, 1, 0], [1, 0, 1]])
     t.masked_scatter_(mask, source)
     self.assertTrue(np.array_equal(t, TensorBase([[1, 1, 1], [2, 1, 3]])))