Merge branch 'feature/refactor-parser' of github.com:explosion/spaCy into refactor/replace-thinc-linalg-backend

This commit is contained in:
shademe 2022-08-11 13:44:59 +02:00
commit 078dcef442

View File

@ -192,7 +192,7 @@ class TextCategorizer(TrainablePipe):
if not any(len(doc) for doc in docs): if not any(len(doc) for doc in docs):
# Handle cases where there are no tokens in any docs. # Handle cases where there are no tokens in any docs.
tensors = [doc.tensor for doc in docs] tensors = [doc.tensor for doc in docs]
xp = get_array_module(tensors) xp = self.model.ops.xp
scores = xp.zeros((len(list(docs)), len(self.labels))) scores = xp.zeros((len(list(docs)), len(self.labels)))
return scores return scores
scores = self.model.predict(docs) scores = self.model.predict(docs)