コード例 #1
0
 def test_mm_2d(self):
     t1 = TensorBase(np.array([[1, 2], [1, 2]]))
     t2 = TensorBase(np.array([[2, 3], [2, 3]]))
     out = t1.mm(t2)
     self.assertTrue(np.alltrue(out.data == [[6, 9], [6, 9]]))
コード例 #2
0
 def test_mm_3d(self):
     t1 = TensorBase(np.array([[1, 2], [2, 3], [3, 4]]))
     t2 = TensorBase(np.array([[1, 2, 3], [2, 3, 4]]))
     out = t1.mm(t2)
     self.assertTrue(np.alltrue(out.data == [[5, 8, 11], [8, 13, 18], [11, 18, 25]]))
コード例 #3
0
 def test_mm_1d(self):
     t1 = TensorBase(np.array([2, 3, 4]))
     t2 = TensorBase(np.array([3, 4, 5]))
     out = t1.mm(t2)
     self.assertTrue(np.alltrue(out.data == [38]))