Use .sum() as in update

This commit is contained in:
Adriane Boyd 2022-11-29 17:18:55 +01:00
parent 4ecccf8460
commit 965bbb3e0d

View File

@ -272,7 +272,7 @@ class SpanCategorizer(TrainablePipe):
DOCS: https://spacy.io/api/spancategorizer#predict
"""
indices = self.suggester(docs, ops=self.model.ops)
if sum(indices.lengths) == 0:
if indices.lengths.sum() == 0:
scores = self.model.ops.alloc2f(0, 0)
else:
scores = self.model.predict((docs, indices)) # type: ignore