def _gemm(z, a, x, y, b): assert a.shape == () assert b.shape == () return b * z + a * numpy.dot(x, y)