Skip to content

Commit 63adf95

Browse files
committed
return raw format.
1 parent 1280e27 commit 63adf95

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

tensorcircuit/cloud/abstraction.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,8 @@ def results(
417417
s = self.state()
418418
if s != "completed":
419419
raise TaskUnfinished(self.id_, s)
420+
if format is not None and format == "raw":
421+
return self.details().get("multi_raw", {})
420422
single_measz = "results" in self.details()
421423
multi_measz = "multi_result" in self.details()
422424
if not single_measz and not multi_measz:

tensorcircuit/cloud/tencent.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,8 @@ def get_task_details(
449449
for i, res in enumerate(r["task"]["multi_results"]):
450450
if "counts" in res:
451451
r["task"]["multi_results"][i] = counts.sort_count(res["counts"])
452+
if "multi_raw" in r["task"]:
453+
r["task"]["multi_raw"] = r["task"]["multi_raw"]
452454
if "optimization" in r["task"]:
453455
if (
454456
"pairs" in r["task"]["optimization"]
@@ -462,7 +464,6 @@ def get_task_details(
462464

463465
# if not "logical_physical_mapping" in r["task"]:
464466
# r["task"]["logical_physical_mapping"] = None
465-
466467
if prettify is False:
467468
return r["task"] # type: ignore
468469
# make the results more readable
@@ -472,6 +473,7 @@ def get_task_details(
472473
if "ts" in r:
473474
for k in r["ts"]:
474475
r["ts"][k] = datetime.fromtimestamp(r["ts"][k] / 1e6)
476+
475477
if r["lang"] == "TQASM":
476478
return r
477479
if "source" in r:

tests/05_test_multi_measure.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ def run_circuit(qc):
5555
# print(qc.to_tqasm())
5656
# n = qc._nqubits
5757
rf = t.results() # 需返回 multi_results
58-
return rf
58+
rf_raw = t.results(format="raw")
59+
return rf, rf_raw
5960

6061
qc = gen_multi_measure_circuit(1.0)
6162
result = run_circuit(qc)

0 commit comments

Comments
 (0)