Skip to content

Commit

Permalink
Fix the file_name/tensor_name conflict issue by using a more explicit…
Browse files Browse the repository at this point in the history
… string
  • Loading branch information
pohantw committed Mar 7, 2024
1 parent 634ef57 commit f40ce01
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions sam/onyx/generate_matrices.py
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,8 @@ def get_tensor_from_files(name, files_dir, shape, base=10,
shape_reordered.insert(mode_tup[1][0], shape[mode_tup[0]])
to_loop = tensor_ordering_sorted
# Get vals first since all formats will have vals
val_f = [fil for fil in all_files if name in fil and f'mode_vals{suffix}' in fil][0]
# regardless of the ordering, the tensor has values, and these two lines get those values
val_f = [fil for fil in all_files if f'tensor_{name}' in fil and f'mode_vals{suffix}' in fil][0]
vals = read_inputs(f"{files_dir}/{val_f}", intype=int, base=base, early_terminate=early_terminate,
positive_only=positive_only)

Expand All @@ -557,8 +558,8 @@ def get_tensor_from_files(name, files_dir, shape, base=10,
crds = []
for mode_original in to_loop:
mode = mode_original
seg_f = [fil for fil in all_files if name in fil and f'mode_{mode}' in fil and f'seg{suffix}' in fil][0]
crd_f = [fil for fil in all_files if name in fil and f'mode_{mode}' in fil and f'crd{suffix}' in fil][0]
seg_f = [fil for fil in all_files if f'tensor_{name}' in fil and f'mode_{mode}' in fil and f'seg{suffix}' in fil][0]
crd_f = [fil for fil in all_files if f'tensor_{name}' in fil and f'mode_{mode}' in fil and f'crd{suffix}' in fil][0]
seg_t_ = read_inputs(f"{files_dir}/{seg_f}", intype=int, base=base, early_terminate=early_terminate,
positive_only=positive_only)
segs.append(seg_t_)
Expand Down

0 comments on commit f40ce01

Please sign in to comment.