Example #1
0
 def testaddcdiv2d(self):
     t1 = TensorBase(np.array([[1, 2], [1, 2]]))
     t2 = TensorBase(np.array([[1, 2], [1, 2]]))
     mat = TensorBase(np.array([[2, 3], [3, 4]]))
     out = t1.addcdiv(t2, mat, value=2)
     self.assertTrue(np.array_equal(out.data, [[4., 5.], [5., 6.]]))
Example #2
0
 def testaddcdiv1d(self):
     t1 = TensorBase(np.array([1, 2, 3]))
     t2 = TensorBase(np.array([2, 5, 4]))
     mat = TensorBase(np.array([5]))
     out = t1.addcdiv(t2, mat, value=2)
     self.assertTrue(np.array_equal(out.data, [6., 5.8, 6.5]))