Skip to content

Commit

Permalink
spancat: replace a cast by an assertion
Browse files Browse the repository at this point in the history
  • Loading branch information
danieldk committed Sep 8, 2022
1 parent b828954 commit 0bd5730
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion spacy/pipeline/spancat.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 0bd5730

Please sign in to comment.