def METHOD_NAME(structureo, structuret, preprocess="direct"):
    c = tc.Circuit(n)
    if preprocess == "softmax":
        structureo = K.softmax(structureo, axis=-1)
        structuret = K.softmax(structuret, axis=-1)
    elif preprocess == "most":
        structureo = K.onehot(K.argmax(structureo, axis=-1), num=7)
        structuret = K.onehot(K.argmax(structuret, axis=-1), num=3)
    elif preprocess == "direct":
        pass
    structureo = K.cast(structureo, ctype)
    structuret = K.cast(structuret, ctype)
    structureo = tf.reshape(structureo, shape=[nlayers, n, 7])
    structuret = tf.reshape(structuret, shape=[nlayers, n, 3])
    for i in range(n):
        c.H(i)
    for j in range(nlayers):
        for i in range(n):
            c.unitary(
                i,
                unitary=structureo[j, i, 0] * tc.gates.i().tensor
                + structureo[j, i, 1] * tc.gates.x().tensor
                + structureo[j, i, 2] * tc.gates.y().tensor
                + structureo[j, i, 3] * tc.gates.z().tensor
                + structureo[j, i, 4] * tc.gates.h().tensor
                + structureo[j, i, 5] * tc.gates.s().tensor
                + structureo[j, i, 6] * tc.gates.sd().tensor,
            )
        for i in range(n - 1):
            c.unitary(
                i,
                i + 1,
                unitary=structuret[j, i, 0] * tc.gates.ii().tensor
                + structuret[j, i, 1] * tc.gates.cnot().tensor
                + structuret[j, i, 2] * tc.gates.cz().tensor,
            )
    # loss = K.real(
    #     sum(
    #         [c.expectation_ps(z=[i, i + 1]) for i in range(n - 1)]
    #         + [c.expectation_ps(x=[i]) for i in range(n)]
    #     )
    # )
    s = c.state()
    loss = -K.real(tc.quantum.entropy(tc.quantum.reduced_density_matrix(s, cut=n // 2)))
    return loss