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

Custom gate with transcendental function produces AttributeError

未關閉
#387 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
Python
星號
74
分支
34
平均合併
2 天 18 小時
30 天內合併 PR
3

描述

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

貢獻指南

開啟貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。