Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolved example error #31

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion examples/pulser_compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import numpy as np
from qadence2_expressions import RX, RY, add_qpu_directives, compile_to_model, parameter
from qadence2_platforms.abstracts import OnEnum
from qadence2_platforms.compiler import compile_to_backend

a = parameter("a")
Expand All @@ -14,5 +15,6 @@

f_params = {"a": np.array([1.0])}
compiled_model = compile_to_backend(model, "fresnel1")
res = compiled_model.sample(values=f_params, shots=10_000, on="emulator")
res = compiled_model.sample(values=f_params, shots=10_000, on=OnEnum.EMULATOR)

print(f"sample result: {res}")
2 changes: 1 addition & 1 deletion examples/pyq_compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@

wf = compiled_model.run(state=pyq.zero_state(2), values=f_params)
dfdx = torch.autograd.grad(wf, f_params["a"], torch.ones_like(wf))[0]
print(f"{dfdx = }\n")
print(f"{dfdx=}\n")
Loading