Skip to content

Commit 42702a8

Browse files
committed
add dtype='object' for numpy array of different shapes
1 parent 1333de2 commit 42702a8

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

higashi/Higashi_wrapper.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -856,8 +856,8 @@ def prep_model(self):
856856
self.validation_data_generator = DataGenerator(test_data, test_chrom, test_weight,
857857
int(self.batch_size / (neg_num + 1)),
858858
False, num_list, k=1)
859-
860-
859+
860+
861861
def forward_batch_hyperedge(self, batch_data, batch_weight, batch_chrom, batch_to_neighs, y,
862862
chroms_in_batch):
863863
model = self.higashi_model
@@ -1298,7 +1298,7 @@ def get_cell_neighbor_be(self, start=1):
12981298
cell_neighbor_list_local[i + 1] = (neighbor + 1)[start:]
12991299
cell_neighbor_weight_list_local[i + 1] = (new_w)
13001300

1301-
return np.array(cell_neighbor_list_local), np.array(cell_neighbor_weight_list_local)
1301+
return np.array(cell_neighbor_list_local, dtype='object'), np.array(cell_neighbor_weight_list_local, dtype='object')
13021302

13031303
def get_cell_neighbor(self, start=1):
13041304
v = self.cell_embeddings if not self.pre_cell_embed else np.load(self.pre_cell_embed)
@@ -1320,7 +1320,8 @@ def get_cell_neighbor(self, start=1):
13201320
cell_neighbor_list_local[i + 1] = (neighbor_new + 1)[start:]
13211321
cell_neighbor_weight_list_local[i + 1] = (new_w)
13221322

1323-
return np.array(cell_neighbor_list_local), np.array(cell_neighbor_weight_list_local)
1323+
return (np.array(cell_neighbor_list_local, dtype='object'),
1324+
np.array(cell_neighbor_weight_list_local, dtype='object'))
13241325

13251326

13261327
def train_for_embeddings(self, max_epochs=None):
@@ -1468,7 +1469,7 @@ def impute_no_nbr(self):
14681469
os.path.join(self.temp_dir, "sparse_nondiag_adj_nbr_1.npy"),
14691470
None,
14701471
select_gpus[i])
1471-
1472+
14721473
impute_pool.shutdown(wait=True)
14731474
linkhdf5("%s_nbr_%d_impute" % (self.embedding_name, 0), cell_id_all, self.temp_dir, self.impute_list,
14741475
None)

0 commit comments

Comments
 (0)