amazon-braket / amazon-braket/amazon-braket-default-simulator-python
Custom gate with transcendental function produces AttributeError
- Langage dominant
- Python
- Étoiles
- 74
- Forks
- 34
- Merge moyen
- 2 j 18 h
- PR mergées (30 j)
- 3
Description
**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.
Guide de contribution
Ouvrir le guide de contribution
Évaluation
Cette issue n'a pas encore été évaluée.