amazon-braket / amazon-braket/amazon-braket-default-simulator-python

Custom gate with transcendental function produces AttributeError

Abierto
#387 0 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
Python
Estrellas
74
Forks
34
Merge medio
2 d 18 h
PR fusionados (30 d)
3

Descripción

**Describe the bug**

Transcendental functions for user defined gates appear to not work, despite that arithmetic does, and that for normal gates these functions work fine. Gate formal parameters may need to be stored as `SymbolLiteral(Symbols(name))`.

**To reproduce**

```python
from braket.devices import LocalSimulator
from braket.ir.openqasm import Program

oq3 = """
OPENQASM 3.0;
input float theta;
bit[1] b;
qubit[1] q;
gate my_gate(arg) r {
rx(sin(arg)) r;
}
my_gate(theta) q[0];
b[0] = measure q[0];
"""

sim = LocalSimulator()
prog = Program(source=oq3, inputs={"theta": 0.5})
result = sim.run(prog, shots=10).result()
```

**Expected behavior**
Works generally, just fails for user-defined gates.

**Screenshots or logs**
If applicable, add screenshots or logs to help explain your problem.

**System information**
A description of your system. Please provide:
- **Amazon Braket Python SDK version**: 1.123.0.post0
- **Amazon Braket Python Schemas version**: 1.29.1
- **Amazon Braket Python Default Simulator version**: 1.39.5
- **Python version**:

**Additional context**
Add any other context about the problem here.

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.