mirror of
https://github.com/explosion/spaCy.git
synced 2025-04-04 17:24:16 +03:00
Try to fix listener
This commit is contained in:
parent
ef9888c1f7
commit
1b8d2ed14f
|
@ -291,8 +291,14 @@ class Tok2VecListener(Model):
|
|||
|
||||
def forward(model: Tok2VecListener, inputs, is_train: bool):
|
||||
"""Supply the outputs from the upstream Tok2Vec component."""
|
||||
|
||||
if is_train:
|
||||
model.verify_inputs(inputs)
|
||||
return model._outputs, model._backprop
|
||||
else:
|
||||
return [doc.tensor for doc in inputs], lambda dX: []
|
||||
if model._outputs is None:
|
||||
outputs = [model.ops.alloc2f(len(doc), width) for doc in inputs]
|
||||
else:
|
||||
outputs = model._outputs
|
||||
model._outputs = None
|
||||
return outputs, lambda dX: []
|
||||
|
|
Loading…
Reference in New Issue
Block a user