Skip to content

Commit ba6ec5b

Browse files
add qpu call sdk design doc
1 parent bab23f7 commit ba6ec5b

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

docs/source/infras.rst

+26-1
Original file line numberDiff line numberDiff line change
@@ -155,4 +155,29 @@ Also, note how ``^`` is overloaded as ``tn.connect`` to connect edges between di
155155
The convention to define the ``QuOperator`` is firstly giving ``out_edges`` (left index or row index of the matrix) and then giving ``in_edges`` (right index or column index of the matrix). The edges list contains edge objects from the TensorNetwork library.
156156

157157
Such QuOperator/QuVector abstraction support various calculations only possible on matrix/vectors, such as matmul (``@``), adjoint (``.adjoint()``), scalar multiplication (``*``), tensor product (``|``), and partial trace (``.partial_trace(subsystems_to_trace_out)``).
158-
To extract the matrix information of these objects, we can use ``.eval()`` or ``.eval_matrix()``, the former keeps the shape information of the tensor network while the latter gives the matrix representation with shape rank 2.
158+
To extract the matrix information of these objects, we can use ``.eval()`` or ``.eval_matrix()``, the former keeps the shape information of the tensor network while the latter gives the matrix representation with shape rank 2.
159+
160+
161+
Quantum Cloud SDK: Layerwise API design
162+
-----------------------------------------------------
163+
164+
From lower level to higher level, a view of API layers invoking QPU calls
165+
166+
- Vendor specific implementation of functional API in, e.g., :py:mod:`tensorcircuit.cloud.tencent`
167+
168+
- Provider agnostic functional lower level API for task/device management in :py:mod:`tensorcircuit.cloud.apis`
169+
170+
- Object oriented abstraction for Provider/Device/Task in :py:mod:`tensorcircuit.cloud.abstraction`
171+
172+
- Unified batch submission interface as standarized in :py:meth:`tensorcircuit.cloud.wrapper.batch_submit_template`
173+
174+
- Numerical and experimental unified all-in-one interface as :py:meth:`tensorcircuit.cloud.wrapper.batch_expectation_ps`
175+
176+
- Application level code with QPU calls built directly on ``batch_expectation_ps`` or more fancy algorithms can be built on ``batch_submit_func`` so that these algorithms can be reused as long as one function ``batch_submit_func`` is defined for a given vendor (cheaper than defining a new provider from lower level).
177+
178+
179+
.. Note::
180+
181+
For compiler, error mitigation and results post-processing parts, they can be carefully designed to decouple with the QPU calls,
182+
so they are separately implemented in :py:mod:`tensorcircuit.compiler` and :py:mod:`tensorcircuit.results`,
183+
and they can be independently useful even without tc's cloud access.

tests/test_cloud.py

+1
Original file line numberDiff line numberDiff line change
@@ -211,3 +211,4 @@ def qmlf(inputs, params, device=None):
211211
inputs = tc.array_to_tensor(np.array([0, 1, 0, 1, 0]))
212212
params = np.ones([2, n])
213213
print(qmlf(inputs, params, device="9gmon"))
214+
print(qmlf(inputs, params))

0 commit comments

Comments
 (0)