def test_tensordot(self): a0 = numpy.random.random((2,2,2)) self.assertTrue(allclose(ctf.tensordot(a0, a0), numpy.tensordot(a0, a0))) self.assertTrue(allclose(ctf.tensordot(a0, a0, 1), numpy.tensordot(a0, a0, 1))) self.assertTrue(allclose(ctf.tensordot(a0, a0, [[1,0],[1,0]]), numpy.tensordot(a0, a0, [[1,0],[1,0]]))) self.assertTrue(allclose(ctf.tensordot(a0, a0, [[0,1],[1,0]]), numpy.tensordot(a0, a0, [[0,1],[1,0]]))) self.assertTrue(allclose(ctf.tensordot(a0, a0, [[2,1,0],[1,0,2]]), numpy.tensordot(a0, a0, [[2,1,0],[1,0,2]]))) with self.assertRaises(IndexError): ctf.tensordot(a0, a0, [[2,1,0,3],[0,1,2,3]])
def tensordot(A, B, axes): return ctf.tensordot(A, B, axes)