Skip to content

Commit

Permalink
test: improve speed for AnnData with lots of metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
ilia-kats committed Sep 21, 2021
1 parent 13eddb8 commit f9ff81f
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions SpatialDE/_internal/tf_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,10 @@ def __init__(

def __call__(self):
for i, g in enumerate(self.genes):
slice = self.adata[:, i]
if self.layer is None:
data = slice.X
data = self.adata.X[:, i]
else:
data = slice.layers[self.layer]
data = self.adata.layers[self.layer][:, i]
if issparse(data):
data = data.toarray()
with tf.device(tf.DeviceSpec(device_type="CPU").to_string()):
Expand Down

0 comments on commit f9ff81f

Please sign in to comment.