import numpy
l = numpy.array([
[[0.0, 1.0, 2.0, 3.0], [4.0, 5.0, 6.0, 7.0]], [[8.0, 9.0, 10.0, 11.0], [12.0, 13.0, 14.0,
15.0]], [[16.0, 17.0, 18.0, 19.0], [20.0, 21.0, 22.0, 23.0]]
]).reshape(2, 4, 3)
r = numpy.array([[0.0, 1.0, 2.0], [3.0, 4.0, 5.0], [6.0, 7.0, 8.0], [9.0, 10.0, 11.0]]).reshape(4, 3)
def test():
o = numpy.array([0.0, 0.0])
for i in range(100):
o += numpy.tensordot(l, r, axes=2)
if (o != numpy.array([100 * 506.0, 100 * 1298.0])).all():
print("ERROR")
t = numpy.array([i for i in range(24)]).reshape(2, 4, 3)
print(t)
print(t.transpose())
t = numpy.array([i for i in range(6)]).reshape(2, 3)
print(t)
print(numpy.tensordot(t.transpose(), t, axes=1))