From 0bd5730d16432443a2b247316928d4f789ad8741 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danie=CC=88l=20de=20Kok?= Date: Thu, 8 Sep 2022 10:33:53 +0200 Subject: [PATCH] spancat: replace a cast by an assertion --- spacy/pipeline/spancat.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spacy/pipeline/spancat.py b/spacy/pipeline/spancat.py index c517991f55a..c0e07a57ef2 100644 --- a/spacy/pipeline/spancat.py +++ b/spacy/pipeline/spancat.py @@ -311,8 +311,9 @@ def set_annotations(self, docs: Iterable[Doc], activations: ActivationsT) -> Non labels = self.labels indices = activations["indices"] + scores = activations["scores"] assert isinstance(indices, Ragged) - scores = cast(Floats2d, activations["scores"]) + assert isinstance(scores, Floats2d) offset = 0 for i, doc in enumerate(docs):