mirror of
https://github.com/explosion/spaCy.git
synced 2025-03-13 07:55:49 +03:00
Fix flake8
This commit is contained in:
parent
1682a60a20
commit
6f7f2131cb
|
@ -80,13 +80,12 @@ def _get_transition_table(
|
|||
B_start, B_end = (0, n_labels)
|
||||
I_start, I_end = (B_end, B_end + n_labels)
|
||||
L_start, L_end = (I_end, I_end + n_labels)
|
||||
U_start, U_end = (L_end, L_end + n_labels)
|
||||
U_start, _ = (L_end, L_end + n_labels)
|
||||
# Using ranges allows us to set specific cells, which is necessary to express
|
||||
# that only actions of the same label are valid continuations.
|
||||
B_range = numpy.arange(B_start, B_end)
|
||||
I_range = numpy.arange(I_start, I_end)
|
||||
L_range = numpy.arange(L_start, L_end)
|
||||
O_action = U_end
|
||||
# If this is the last token and the previous action was B or I, only L
|
||||
# of that label is valid
|
||||
table[1, B_range, L_range] = 1
|
||||
|
|
|
@ -38,8 +38,8 @@ def forward(model, X, is_train):
|
|||
|
||||
|
||||
def init(model, X=None, Y=None):
|
||||
tok2vec = model.get_ref("tok2vec").initialize(X=X)
|
||||
lower = model.get_ref("lower").initialize()
|
||||
model.get_ref("tok2vec").initialize(X=X)
|
||||
model.get_ref("lower").initialize()
|
||||
if model.attrs["has_upper"]:
|
||||
statevecs = model.ops.alloc2f(2, lower.get_dim("nO"))
|
||||
model.get_ref("upper").initialize(X=statevecs)
|
||||
|
|
Loading…
Reference in New Issue
Block a user