From 7b20023e84b3c2010c518b866ef072ef0f64f9d6 Mon Sep 17 00:00:00 2001 From: avantikalal Date: Tue, 16 Jul 2024 19:07:32 +0000 Subject: [PATCH] convert indices to int8 before stacking --- src/grelu/sequence/format.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/grelu/sequence/format.py b/src/grelu/sequence/format.py index 5ba944d..c1b376d 100644 --- a/src/grelu/sequence/format.py +++ b/src/grelu/sequence/format.py @@ -252,8 +252,11 @@ def strings_to_indices( strings ), "All input sequences must have the same length." return np.stack( - [[BASE_TO_INDEX_HASH[base] for base in string] for string in strings] - ).astype(np.int8) + [ + np.array([BASE_TO_INDEX_HASH[base] for base in string], dtype(np.int8)) + for string in strings + ] + ) def indices_to_one_hot(indices: np.ndarray) -> Tensor: