Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

[Design] Add ability to reason about Circuit structure

Abierto
#292 8 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
25/100
Tipo de issue
Nueva funcionalidad
Claridad
Necesita aclaración
Estado de actividad
Estancado
Stack tecnológico
python
Área
api

Línea de trabajo

Comienza con el ejemplo de tfq.convert_to_tensor del issue y el punto de entrada propuesto tfq.circuit_structure; después, revisa las entradas de circuitos Cirq serializados y los alfabetos de puertas y símbolos sugeridos. Para darlo por terminado, se requiere una representación acordada de las salidas encoding y params, incluido cómo se representan la estructura del circuito, los símbolos, los qubits y la profundidad.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

area/circuits area/cirq help wanted kind/feature-request skill-level/expert

It would be a very useful feature to be able to reason about "Circuit structures". Supporting this feature would mean that we would roughly need to be able create an op to do the following:


my_circuit = cirq.Circuit(cirq.H(q0), cirq.CNOT(q0, q1), cirq.Y(q1) ** beta)
circuit_tensor = tfq.convert_to_tensor([my_circuit])
structure_grid = tfq.circuit_structure(circuit_tensor)

print(structure_grid)
# [[...], ...]  some kind of meaningful 2d description of the circuit. 
# Should maybe be something like [batch_size, ragged on n_qubits, ragged on depth, n_channels] 
# Maybe an additional output to track symbols as well ?

My current thinking is that we do something like this:
have the following inputs:

(optional) gate_alphabet where gate_alphabet[gate] = a unique integer value
(optional) symbol_alphabet[symbol_name] = a unique integer value different from any in gate_alphabet
circuits[i] = a serialized cirq.Circuit`
symbol_names = a list of all symbols found in all the circuits in circuits

Outputs:

encoding[i][j][k] = gate_alphabet[operation from circuits[i] at moment j at qubit index k] 

params[i][j][k][l] = symbol_alphabet[parameter l from operation from circuits[i] at moment j at qubit index k]
    or the value of l if it isn't a symbol.

What do people think ?

Going to leave open for discussion with @vprusso and others.

Lenguaje dominante
Python
Estrellas
2.2k
Forks
665
Métricas de merge de PR
Sin PR fusionados en 30 d

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de tensorflow/quantum

Todos los issues de tensorflow/quantum

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.