Example #1
0
 def test_baddbmm(self):
     t1 = TensorBase(np.array([[[3, 4], [5, 6]], [[7, 8], [1, 2]]]))
     t2 = TensorBase(np.array([[[3, 5], [5, 7]], [[7, 9], [1, 3]]]))
     mat = TensorBase(np.array([[[2, 3], [3, 4]], [[4, 5], [5, 6]]]))
     out = syft.baddbmm(t1, t2, mat, beta=2, alpha=2)
     self.assertTrue(np.array_equal(out.data, [[[62, 92], [96, 142]],
                                               [[122, 184], [28, 42]]]))
Example #2
0
 def baddbmm(self, tensor2, mat, beta=1, alpha=1):
     """Performs a batch matrix-matrix product of matrices in
     batch1(tensor1) and batch2(tensor2). mat is added to the final result.
       resi=(beta∗Mi)+(alpha∗batch1i×batch2i)
       *batch1 and batch2 must be 3D Tensors each containing the same number
       of matrices."""
     return syft.baddbmm(self, tensor2, mat, beta, alpha)