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

Custom gate with transcendental function produces AttributeError

Aberta
#387 0 comentários 0 reações 0 responsáveis Ver no GitHub
Linguagem predominante
Python
Estrelas
74
Forks
34
Merge médio
2d 18h
PRs com merge (30d)
3

Descrição

**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.

Guia de contribuição

Abrir o guia de contribuição

Avaliação

Esta issue ainda não foi avaliada.

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.