Skip to content

Commit

Permalink
fix `TypeError: arrays to stack must be passed as a "sequence" type s…
Browse files Browse the repository at this point in the history
…uch as list or tuple.`
  • Loading branch information
mshr-h committed Oct 30, 2024
1 parent f6ccb7b commit f2730a4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion python/tvm/contrib/sparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def numpy(self):
"""Construct a full matrix and convert it to numpy array."""
full = _np.zeros(self.shape, self.dtype)
ridx = _np.diff(self.indptr.numpy())
ridx = _np.hstack((_np.ones((v,), itype) * i for i, v in enumerate(ridx)))
ridx = _np.hstack([_np.ones((v,), itype) * i for i, v in enumerate(ridx)])
full[ridx, self.indices.numpy().astype(itype)] = self.data.numpy()
return full

Expand Down
12 changes: 6 additions & 6 deletions tests/python/contrib/test_cublas.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,22 +82,22 @@ def verify(target="cuda"):
b_old = np.random.uniform(0, 128, size=(l, m))

# Transform a to become CUBLASLT_ORDER_COL4_4R2_8C layout
a_new = np.hstack((a_old.astype(A.dtype), np.zeros([n, L - l])))
a_new = np.vstack((a_new.astype(A.dtype), np.zeros([N - n, L])))
a_new = np.hstack([a_old.astype(A.dtype), np.zeros([n, L - l])])
a_new = np.vstack([a_new.astype(A.dtype), np.zeros([N - n, L])])
a_even = np.vsplit(a_new[::2], N / 8)
a_odd = np.vsplit(a_new[1::2], N / 8)
a_new = [None] * (len(a_even) + len(a_odd))
a_new[::2] = a_even
a_new[1::2] = a_odd
a_new = np.vstack(a_new)
a_new = np.vstack(
np.vstack(np.vstack(np.hsplit(i, 8)).reshape([4, 32]) for i in np.vsplit(j, N / 4))
a_new = np.vstack([
np.vstack([np.vstack(np.hsplit(i, 8)).reshape([4, 32]) for i in np.vsplit(j, N / 4)])
for j in np.hsplit(a_new, L / 32)
)
])
a_new = a_new.reshape([N, L])
# Transform b to become CUBLASLT_ORDER_COL32 layout
b_new = np.vstack(
np.hsplit(np.hstack((b_old.T.astype(B.dtype), np.zeros([m, L - l]))), L / 32)
np.hsplit(np.hstack([b_old.T.astype(B.dtype), np.zeros([m, L - l])]), L / 32)
)
b_new = b_new.reshape([m, L])

Expand Down
2 changes: 1 addition & 1 deletion tests/python/frontend/coreml/test_forward.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ def _verify_average(input_dim1, input_dim2, axis=0):
a_np1 = np.random.uniform(size=input_dim1).astype(dtype)
a_np2 = np.random.uniform(size=input_dim2).astype(dtype)

b_np = np.mean((a_np1, a_np2), axis=axis)
b_np = np.mean((a_np1, a_np2), axis=axis, dtype=float)

inputs = [("input1", datatypes.Array(*input_dim1)), ("input2", datatypes.Array(*input_dim2))]
output = [("output", datatypes.Array(*b_np.shape))]
Expand Down

0 comments on commit f2730a4

Please sign in to comment.