File tree 1 file changed +16
-5
lines changed
1 file changed +16
-5
lines changed Original file line number Diff line number Diff line change 16
16
import jax .numpy as jnp
17
17
from jax .tree_util import register_pytree_node_class
18
18
19
- from .tensor import PEPS_Tensor
19
+ from .tensor import PEPS_Tensor , PEPS_Tensor_Split_Transfer
20
20
import varipeps
21
21
from varipeps .utils .random import PEPS_Random_Number_Generator
22
22
from varipeps .utils .periodic_indices import calculate_periodic_indices
@@ -150,10 +150,21 @@ def load_from_group(
150
150
HDF5 group object to load the data from.
151
151
"""
152
152
structure = tuple (tuple (int (j ) for j in i ) for i in grp ["structure" ])
153
- peps_tensors = [
154
- PEPS_Tensor .load_from_group (grp ["peps_tensors" ][f"t_{ ti :d} " ])
155
- for ti in range (grp ["peps_tensors" ].attrs ["len" ])
156
- ]
153
+ try :
154
+ peps_tensors = [
155
+ PEPS_Tensor .load_from_group (grp ["peps_tensors" ][f"t_{ ti :d} " ])
156
+ for ti in range (grp ["peps_tensors" ].attrs ["len" ])
157
+ ]
158
+ except KeyError as e :
159
+ try :
160
+ peps_tensors = [
161
+ PEPS_Tensor_Split_Transfer .load_from_group (
162
+ grp ["peps_tensors" ][f"t_{ ti :d} " ]
163
+ )
164
+ for ti in range (grp ["peps_tensors" ].attrs ["len" ])
165
+ ]
166
+ except KeyError :
167
+ raise e
157
168
158
169
return cls (structure = structure , peps_tensors = peps_tensors )
159
170
You can’t perform that action at this time.
0 commit comments