From 965bbb3e0dadb6644814862fc5977c252877c23b Mon Sep 17 00:00:00 2001 From: Adriane Boyd Date: Tue, 29 Nov 2022 17:18:55 +0100 Subject: [PATCH] Use .sum() as in update --- spacy/pipeline/spancat.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spacy/pipeline/spancat.py b/spacy/pipeline/spancat.py index fc6ad5ee1..5c1f77cf6 100644 --- a/spacy/pipeline/spancat.py +++ b/spacy/pipeline/spancat.py @@ -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