Skip to content

Commit 92a985c

Browse files
time in example
1 parent eef1562 commit 92a985c

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

examples/slicing_auto_pmap_mpo.py

+3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
from functools import partial
77
import os
8+
import time
89

910
num_device = 4
1011
os.environ["XLA_FLAGS"] = f"--xla_force_host_platform_device_count={num_device}"
@@ -113,7 +114,9 @@ def para_vag(params, i, tree, n, d, tc_mpo, opt_state):
113114
inds = K.arange(num_device)
114115
for j in range(100):
115116
print(f"training loop: {j}-step")
117+
time0 = time.time()
116118
replicated_params, replicated_opt_state, loss = para_vag(
117119
replicated_params, inds, tree, nqubit, d, tc_mpo, replicated_opt_state
118120
)
121+
print("running time:", time.time() - time0)
119122
print(loss[0])

0 commit comments

Comments
 (0)