Beispiel #1
0
 def test_addmv(self):
     t1 = TensorBase(np.array([1, 2]))
     vec = TensorBase(np.array([1, 2, 3, 4]))
     mat = TensorBase(np.array([[2, 3, 3, 4], [5, 6, 6, 7]]))
     out = syft.addmv(t1, mat, vec, beta=2, alpha=2)
     self.assertTrue(np.array_equal(out.data, [68, 130]))
Beispiel #2
0
 def addmv(self, mat, vec, beta=1, alpha=1):
     """"Performs a matrix-vector product of the matrix mat and the vector
      vec. The vector tensor is added to the final result.
           tensor1 and vec are 1d tensors
           out=(beta∗tensor)+(alpha∗(mat@vec2))"""
     return syft.addmv(self, mat, vec, beta, alpha)