Skip to content

Commit

Permalink
deploy: daf9e9d
Browse files Browse the repository at this point in the history
  • Loading branch information
laurencap committed Feb 2, 2024
1 parent bd1d798 commit 32c0375
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .buildinfo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: b60b2366dda87bd7fecf787e55cb7ed2
config: ef4bfbc902a8f91a80ea613f548a0a1b
tags: 645f666f9bcd5a90fca523b33c5a78b7
Binary file modified .doctrees/environment.pickle
Binary file not shown.
17 changes: 17 additions & 0 deletions _modules/qiskit_braket_provider/providers/braket_backend.html
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ <h1>Source code for qiskit_braket_provider.providers.braket_backend</h1><div cla

<span class="kn">import</span> <span class="nn">datetime</span>
<span class="kn">import</span> <span class="nn">logging</span>
<span class="kn">import</span> <span class="nn">enum</span>
<span class="kn">from</span> <span class="nn">abc</span> <span class="kn">import</span> <span class="n">ABC</span>
<span class="kn">from</span> <span class="nn">typing</span> <span class="kn">import</span> <span class="n">Iterable</span><span class="p">,</span> <span class="n">Union</span><span class="p">,</span> <span class="n">List</span>

Expand Down Expand Up @@ -276,6 +277,15 @@ <h1>Source code for qiskit_braket_provider.providers.braket_backend</h1><div cla
<span class="k">def</span> <span class="fm">__repr__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="k">return</span> <span class="sa">f</span><span class="s2">&quot;BraketBackend[</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">name</span><span class="si">}</span><span class="s2">]&quot;</span>

<span class="k">def</span> <span class="nf">_validate_meas_level</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">meas_level</span><span class="p">:</span> <span class="n">Union</span><span class="p">[</span><span class="n">enum</span><span class="o">.</span><span class="n">Enum</span><span class="p">,</span> <span class="nb">int</span><span class="p">]):</span>
<span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">meas_level</span><span class="p">,</span> <span class="n">enum</span><span class="o">.</span><span class="n">Enum</span><span class="p">):</span>
<span class="n">meas_level</span> <span class="o">=</span> <span class="n">meas_level</span><span class="o">.</span><span class="n">value</span>
<span class="k">if</span> <span class="n">meas_level</span> <span class="o">!=</span> <span class="mi">2</span><span class="p">:</span>
<span class="k">raise</span> <span class="n">QiskitBraketException</span><span class="p">(</span>
<span class="sa">f</span><span class="s2">&quot;Device </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">name</span><span class="si">}</span><span class="s2"> only supports classified measurement &quot;</span>
<span class="sa">f</span><span class="s2">&quot;results, received meas_level=</span><span class="si">{</span><span class="n">meas_level</span><span class="si">}</span><span class="s2">.&quot;</span>
<span class="p">)</span>


<div class="viewcode-block" id="BraketLocalBackend">
<a class="viewcode-back" href="../../../stubs/qiskit_braket_provider.providers.BraketLocalBackend.html#qiskit_braket_provider.providers.BraketLocalBackend">[docs]</a>
Expand Down Expand Up @@ -354,6 +364,9 @@ <h1>Source code for qiskit_braket_provider.providers.braket_backend</h1><div cla
<span class="n">shots</span> <span class="o">=</span> <span class="n">options</span><span class="p">[</span><span class="s2">&quot;shots&quot;</span><span class="p">]</span> <span class="k">if</span> <span class="s2">&quot;shots&quot;</span> <span class="ow">in</span> <span class="n">options</span> <span class="k">else</span> <span class="mi">1024</span>
<span class="k">if</span> <span class="n">shots</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
<span class="n">circuits</span> <span class="o">=</span> <span class="nb">list</span><span class="p">(</span><span class="nb">map</span><span class="p">(</span><span class="k">lambda</span> <span class="n">x</span><span class="p">:</span> <span class="n">x</span><span class="o">.</span><span class="n">state_vector</span><span class="p">(),</span> <span class="n">circuits</span><span class="p">))</span>
<span class="k">if</span> <span class="s2">&quot;meas_level&quot;</span> <span class="ow">in</span> <span class="n">options</span><span class="p">:</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_validate_meas_level</span><span class="p">(</span><span class="n">options</span><span class="p">[</span><span class="s2">&quot;meas_level&quot;</span><span class="p">])</span>
<span class="k">del</span> <span class="n">options</span><span class="p">[</span><span class="s2">&quot;meas_level&quot;</span><span class="p">]</span>
<span class="n">tasks</span> <span class="o">=</span> <span class="p">[]</span>
<span class="k">try</span><span class="p">:</span>
<span class="k">for</span> <span class="n">circuit</span> <span class="ow">in</span> <span class="n">circuits</span><span class="p">:</span>
Expand Down Expand Up @@ -529,6 +542,10 @@ <h1>Source code for qiskit_braket_provider.providers.braket_backend</h1><div cla
<span class="k">else</span><span class="p">:</span>
<span class="k">raise</span> <span class="n">QiskitBraketException</span><span class="p">(</span><span class="sa">f</span><span class="s2">&quot;Unsupported input type: </span><span class="si">{</span><span class="nb">type</span><span class="p">(</span><span class="n">run_input</span><span class="p">)</span><span class="si">}</span><span class="s2">&quot;</span><span class="p">)</span>

<span class="k">if</span> <span class="s2">&quot;meas_level&quot;</span> <span class="ow">in</span> <span class="n">options</span><span class="p">:</span>
<span class="bp">self</span><span class="o">.</span><span class="n">_validate_meas_level</span><span class="p">(</span><span class="n">options</span><span class="p">[</span><span class="s2">&quot;meas_level&quot;</span><span class="p">])</span>
<span class="k">del</span> <span class="n">options</span><span class="p">[</span><span class="s2">&quot;meas_level&quot;</span><span class="p">]</span>

<span class="n">braket_circuits</span> <span class="o">=</span> <span class="nb">list</span><span class="p">(</span><span class="n">convert_qiskit_to_braket_circuits</span><span class="p">(</span><span class="n">circuits</span><span class="p">))</span>

<span class="k">if</span> <span class="n">options</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="s2">&quot;verbatim&quot;</span><span class="p">,</span> <span class="kc">False</span><span class="p">):</span>
Expand Down

0 comments on commit 32c0375

Please sign in to comment.