Skip to content

Commit

Permalink
Merge pull request #144 from weiya711/regression_refactor
Browse files Browse the repository at this point in the history
Regression refactor
  • Loading branch information
bobcheng15 authored Jan 26, 2025
2 parents 4f3cf6d + f69b5e2 commit 2c516d0
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 @@ -43,8 +43,8 @@ def __init__(self, name='B', shape=None, sparsity=0.6, format='CSF', dump_dir=No
self.dump_dir = tempfile.gettempdir()

if tensor is not None:
if not tensor.dtype == numpy.float32:
self.array = tensor
if not self.use_fp:
self.array = tensor.astype(numpy.uint16, casting='unsafe')
self.shape = self.array.shape
else:
self.array = tensor
Expand Down Expand Up @@ -490,7 +490,8 @@ def create_matrix_from_point_list(name, pt_list, shape, use_fp=False, base=16) -
else:
mat_base = mat_base.astype(numpy.uint16, casting='unsafe')

mg = MatrixGenerator(name=f"{name}", shape=shape, sparsity=0.7, format='CSF', dump_dir=None, tensor=mat_base)
mg = MatrixGenerator(name=f"{name}", shape=shape, sparsity=0.7, format='CSF',
dump_dir=None, tensor=mat_base, use_fp=use_fp)
return mg


Expand Down

0 comments on commit 2c516d0

Please sign in to comment.