def _npBatchMatmul(self, x, y, adjoint_a, adjoint_b):
    d0 = (x.shape[(- 2)] if (not adjoint_a) else x.shape[(- 1)])
    d2 = (y.shape[(- 1)] if (not adjoint_b) else y.shape[(- 2)])
    batch_dims = x.shape[:(- 2)]
    num = np.prod(batch_dims)
    z = np.empty((list(batch_dims) + [d0, d2]), dtype=x.dtype)
    xr = x.reshape([num, x.shape[(- 2)], x.shape[(- 1)]])
    yr = y.reshape([num, y.shape[(- 2)], y.shape[(- 1)]])
    zr = z.reshape([num, z.shape[(- 2)], z.shape[(- 1)]])
    for i in range(num):
        a = np.matrix(xr[i, :, :])
        if adjoint_a:
            a = a.transpose().conj()
        b = np.matrix(yr[i, :, :])
        if adjoint_b:
            b = b.transpose().conj()
        zr[i, :, :] = (a * b)
    return z
def _npBatchMatmul(self, x, y, adjoint_a, adjoint_b):
    d0 = (x.shape[(- 2)] if (not adjoint_a) else x.shape[(- 1)])
    d2 = (y.shape[(- 1)] if (not adjoint_b) else y.shape[(- 2)])
    batch_dims = x.shape[:(- 2)]
    num = np.prod(batch_dims)
    z = np.empty((list(batch_dims) + [d0, d2]), dtype=x.dtype)
    xr = x.reshape([num, x.shape[(- 2)], x.shape[(- 1)]])
    yr = y.reshape([num, y.shape[(- 2)], y.shape[(- 1)]])
    zr = z.reshape([num, z.shape[(- 2)], z.shape[(- 1)]])
    for i in range(num):
        a = np.matrix(xr[i, :, :])
        if adjoint_a:
            a = a.transpose().conj()
        b = np.matrix(yr[i, :, :])
        if adjoint_b:
            b = b.transpose().conj()
        zr[i, :, :] = (a * b)
    return z