Skip to content

Commit

Permalink
rename native to verbatim
Browse files Browse the repository at this point in the history
  • Loading branch information
ajberdy committed Jul 19, 2023
1 parent 7044617 commit 9c4b85e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
16 changes: 9 additions & 7 deletions src/braket/pennylane_plugin/braket_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ class BraketQubitDevice(QubitDevice):
``0``, the device runs in analytic mode (calculations will be exact).
noise_model (NoiseModel or None): The Braket noise model to apply to the circuit before
execution.
native (bool): Whether to use the native gate set for the device. Default False.
verbatim (bool): Whether to verbatim mode for the device. Note that verbatim mode only
supports the native gate set of the device. Default False.
`**run_kwargs`: Variable length keyword arguments for ``braket.devices.Device.run()``.
"""
name = "Braket PennyLane plugin"
Expand All @@ -114,14 +115,14 @@ def __init__(
*,
shots: Union[int, None],
noise_model: Optional[NoiseModel] = None,
native: bool = False,
verbatim: bool = False,
**run_kwargs,
):
if DeviceActionType.OPENQASM not in device.properties.action:
raise ValueError(f"Device {device.name} does not support quantum circuits")

if (
native
verbatim
and "verbatim"
not in device.properties.action[DeviceActionType.OPENQASM].supportedPragmas
):
Expand All @@ -133,9 +134,9 @@ def __init__(
self._task = None
self._noise_model = noise_model
self._run_kwargs = run_kwargs
self._supported_ops = supported_operations(self._device, native=native)
self._supported_ops = supported_operations(self._device, native=verbatim)
self._check_supported_result_types()
self._native = native
self._verbatim = verbatim

if noise_model:
self._validate_noise_model_support()
Expand Down Expand Up @@ -184,7 +185,7 @@ def _pl_to_braket_circuit(
trainable_indices=trainable_indices,
**run_kwargs,
)
if self._native:
if self._verbatim:
braket_circuit = Circuit().add_verbatim_box(braket_circuit)
if compute_gradient:
braket_circuit = self._apply_gradient_result_type(circuit, braket_circuit)
Expand Down Expand Up @@ -519,7 +520,8 @@ class BraketAwsQubitDevice(BraketQubitDevice):
max_retries (int): The maximum number of retries to use for batch execution.
When executing tasks in parallel, failed tasks will be retried up to ``max_retries``
times. Ignored if ``parallel=False``.
native (bool): Whether to use the native gate set for the device. Default False.
verbatim (bool): Whether to verbatim mode for the device. Note that verbatim mode only
supports the native gate set of the device. Default False.
`**run_kwargs`: Variable length keyword arguments for ``braket.devices.Device.run()``.
"""
name = "Braket AwsDevice for PennyLane"
Expand Down
4 changes: 2 additions & 2 deletions test/unit_tests/test_braket_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -2002,7 +2002,7 @@ def test_verbatim_unsupported(device_type):
wires=2,
device_arn="foo",
device_type=device_type,
native=True,
verbatim=True,
)


Expand All @@ -2014,7 +2014,7 @@ def test_native(mock_run, device_type):
device_arn="foo",
device_type=device_type,
action_properties=ACTION_PROPERTIES_NATIVE,
native=True,
verbatim=True,
native_gate_set=["GPI", "GPI2", "MS"],
)

Expand Down

0 comments on commit 9c4b85e

Please sign in to comment.